##// END OF EJS Templates
Modification of the launch of NORMAL, SBM1 and SBM2 modes
paul -
r238:3412b0dcc87a R3
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 07e22c5c44daa84954a10db557a74b8c8dd2d014 header/lfr_common_headers
2 e1bf35e31e3c8c1d1448d2e485c71f5f1259615c header/lfr_common_headers
@@ -12,7 +12,7 SWVERSION=-1-0
12 DEFINES += SW_VERSION_N1=3 # major
12 DEFINES += SW_VERSION_N1=3 # major
13 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N2=0 # minor
14 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N3=0 # patch
15 DEFINES += SW_VERSION_N4=12 # internal
15 DEFINES += SW_VERSION_N4=13 # internal
16
16
17 # <GCOV>
17 # <GCOV>
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
@@ -34,6 +34,7 int action_update_time( ccsdsTelecommand
34 int check_mode_value( unsigned char requestedMode );
34 int check_mode_value( unsigned char requestedMode );
35 int check_mode_transition( unsigned char requestedMode );
35 int check_mode_transition( unsigned char requestedMode );
36 int check_transition_date( unsigned int transitionCoarseTime );
36 int check_transition_date( unsigned int transitionCoarseTime );
37 int stop_spectral_matrices( void );
37 int stop_current_mode( void );
38 int stop_current_mode( void );
38 int enter_mode_standby( void );
39 int enter_mode_standby( void );
39 int enter_mode_normal( unsigned int transitionCoarseTime );
40 int enter_mode_normal( unsigned int transitionCoarseTime );
@@ -41,10 +42,11 int enter_mode_burst( unsigned int trans
41 int enter_mode_sbm1( unsigned int transitionCoarseTime );
42 int enter_mode_sbm1( unsigned int transitionCoarseTime );
42 int enter_mode_sbm2( unsigned int transitionCoarseTime );
43 int enter_mode_sbm2( unsigned int transitionCoarseTime );
43 int restart_science_tasks( unsigned char lfrRequestedMode );
44 int restart_science_tasks( unsigned char lfrRequestedMode );
44 int suspend_science_tasks();
45 int restart_asm_tasks(unsigned char lfrRequestedMode );
46 int suspend_science_tasks(void);
47 int suspend_asm_tasks( void );
45 void launch_waveform_picker( unsigned char mode , unsigned int transitionCoarseTime );
48 void launch_waveform_picker( unsigned char mode , unsigned int transitionCoarseTime );
46 void launch_spectral_matrix( void );
49 void launch_spectral_matrix( void );
47 void launch_spectral_matrix_simu( void );
48 void set_sm_irq_onNewMatrix( unsigned char value );
50 void set_sm_irq_onNewMatrix( unsigned char value );
49 void set_sm_irq_onError( unsigned char value );
51 void set_sm_irq_onError( unsigned char value );
50
52
@@ -59,7 +59,8 int send_waveform_CWF3_light(ring_node *
59 //
59 //
60 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
60 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
61 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
61 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
62 void build_snapshot_from_ring(ring_node *ring_node_to_send, unsigned char frequencyChannel , unsigned long long acquisitionTimeF0_asLong);
62 void build_snapshot_from_ring(ring_node *ring_node_to_send, unsigned char frequencyChannel ,
63 unsigned long long acquisitionTimeF0_asLong, ring_node *ring_node_swf_extracted, int *swf_extracted);
63 void snapshot_resynchronization( unsigned char *timePtr );
64 void snapshot_resynchronization( unsigned char *timePtr );
64 //
65 //
65 rtems_id get_pkts_queue_id( void );
66 rtems_id get_pkts_queue_id( void );
@@ -121,7 +121,7 rtems_task Init( rtems_task_argument ign
121 PRINTF1("** %d.", SW_VERSION_N1)
121 PRINTF1("** %d.", SW_VERSION_N1)
122 PRINTF1("%d." , SW_VERSION_N2)
122 PRINTF1("%d." , SW_VERSION_N2)
123 PRINTF1("%d." , SW_VERSION_N3)
123 PRINTF1("%d." , SW_VERSION_N3)
124 PRINTF1("%d **\n", SW_VERSION_N4)
124 PRINTF1("%d **\n", SW_VERSION_N4)
125
125
126 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
126 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
127 PRINTF("** VHDL **\n")
127 PRINTF("** VHDL **\n")
@@ -479,6 +479,57 int check_transition_date( unsigned int
479 return status;
479 return status;
480 }
480 }
481
481
482 int restart_asm_activities( unsigned char lfrRequestedMode )
483 {
484 rtems_status_code status;
485
486 status = stop_spectral_matrices();
487
488 status = restart_asm_tasks( lfrRequestedMode );
489
490 launch_spectral_matrix();
491
492 return status;
493 }
494
495 int stop_spectral_matrices( void )
496 {
497 /** This function stops and restarts the current mode average spectral matrices activities.
498 *
499 * @return RTEMS directive status codes:
500 * - RTEMS_SUCCESSFUL - task restarted successfully
501 * - RTEMS_INVALID_ID - task id invalid
502 * - RTEMS_ALREADY_SUSPENDED - task already suspended
503 *
504 */
505
506 rtems_status_code status;
507
508 status = RTEMS_SUCCESSFUL;
509
510 // (1) mask interruptions
511 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
512
513 // (2) reset spectral matrices registers
514 set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
515 reset_sm_status();
516
517 // (3) clear interruptions
518 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
519
520 // suspend several tasks
521 if (lfrCurrentMode != LFR_MODE_STANDBY) {
522 status = suspend_asm_tasks();
523 }
524
525 if (status != RTEMS_SUCCESSFUL)
526 {
527 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
528 }
529
530 return status;
531 }
532
482 int stop_current_mode( void )
533 int stop_current_mode( void )
483 {
534 {
484 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
535 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
@@ -496,14 +547,14 int stop_current_mode( void )
496
547
497 // (1) mask interruptions
548 // (1) mask interruptions
498 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
549 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
499 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
550 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
500
551
501 // (2) reset waveform picker registers
552 // (2) reset waveform picker registers
502 reset_wfp_burst_enable(); // reset burst and enable bits
553 reset_wfp_burst_enable(); // reset burst and enable bits
503 reset_wfp_status(); // reset all the status bits
554 reset_wfp_status(); // reset all the status bits
504
555
505 // (3) reset spectral matrices registers
556 // (3) reset spectral matrices registers
506 set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
557 set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
507 reset_sm_status();
558 reset_sm_status();
508
559
509 // reset lfr VHDL module
560 // reset lfr VHDL module
@@ -582,9 +633,11 int enter_mode_normal( unsigned int tran
582 }
633 }
583 break;
634 break;
584 case LFR_MODE_SBM1:
635 case LFR_MODE_SBM1:
636 restart_asm_activities( LFR_MODE_NORMAL );
585 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
637 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
586 break;
638 break;
587 case LFR_MODE_SBM2:
639 case LFR_MODE_SBM2:
640 restart_asm_activities( LFR_MODE_NORMAL );
588 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
641 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
589 break;
642 break;
590 default:
643 default:
@@ -646,6 +699,7 int enter_mode_sbm1( unsigned int transi
646 }
699 }
647 break;
700 break;
648 case LFR_MODE_NORMAL: // lfrCurrentMode will be updated after the execution of close_action
701 case LFR_MODE_NORMAL: // lfrCurrentMode will be updated after the execution of close_action
702 restart_asm_activities( LFR_MODE_SBM1 );
649 status = LFR_SUCCESSFUL;
703 status = LFR_SUCCESSFUL;
650 break;
704 break;
651 case LFR_MODE_BURST:
705 case LFR_MODE_BURST:
@@ -658,6 +712,7 int enter_mode_sbm1( unsigned int transi
658 }
712 }
659 break;
713 break;
660 case LFR_MODE_SBM2:
714 case LFR_MODE_SBM2:
715 restart_asm_activities( LFR_MODE_SBM1 );
661 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
716 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
662 break;
717 break;
663 default:
718 default:
@@ -694,6 +749,7 int enter_mode_sbm2( unsigned int transi
694 }
749 }
695 break;
750 break;
696 case LFR_MODE_NORMAL:
751 case LFR_MODE_NORMAL:
752 restart_asm_activities( LFR_MODE_SBM2 );
697 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
753 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
698 break;
754 break;
699 case LFR_MODE_BURST:
755 case LFR_MODE_BURST:
@@ -706,6 +762,7 int enter_mode_sbm2( unsigned int transi
706 }
762 }
707 break;
763 break;
708 case LFR_MODE_SBM1:
764 case LFR_MODE_SBM1:
765 restart_asm_activities( LFR_MODE_SBM2 );
709 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
766 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
710 break;
767 break;
711 default:
768 default:
@@ -721,7 +778,7 int enter_mode_sbm2( unsigned int transi
721 return status;
778 return status;
722 }
779 }
723
780
724 int restart_science_tasks(unsigned char lfrRequestedMode )
781 int restart_science_tasks( unsigned char lfrRequestedMode )
725 {
782 {
726 /** This function is used to restart all science tasks.
783 /** This function is used to restart all science tasks.
727 *
784 *
@@ -812,7 +869,72 int restart_science_tasks(unsigned char
812 return ret;
869 return ret;
813 }
870 }
814
871
815 int suspend_science_tasks()
872 int restart_asm_tasks( unsigned char lfrRequestedMode )
873 {
874 /** This function is used to restart average spectral matrices tasks.
875 *
876 * @return RTEMS directive status codes:
877 * - RTEMS_SUCCESSFUL - task restarted successfully
878 * - RTEMS_INVALID_ID - task id invalid
879 * - RTEMS_INCORRECT_STATE - task never started
880 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
881 *
882 * ASM tasks are AVF0, PRC0, AVF1, PRC1, AVF2 and PRC2
883 *
884 */
885
886 rtems_status_code status[6];
887 rtems_status_code ret;
888
889 ret = RTEMS_SUCCESSFUL;
890
891 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
892 if (status[0] != RTEMS_SUCCESSFUL)
893 {
894 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
895 }
896
897 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
898 if (status[1] != RTEMS_SUCCESSFUL)
899 {
900 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
901 }
902
903 status[2] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
904 if (status[2] != RTEMS_SUCCESSFUL)
905 {
906 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[2])
907 }
908
909 status[3] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
910 if (status[3] != RTEMS_SUCCESSFUL)
911 {
912 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[3])
913 }
914
915 status[4] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
916 if (status[4] != RTEMS_SUCCESSFUL)
917 {
918 PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[4])
919 }
920
921 status[5] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
922 if (status[5] != RTEMS_SUCCESSFUL)
923 {
924 PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[5])
925 }
926
927 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
928 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
929 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
930 {
931 ret = RTEMS_UNSATISFIED;
932 }
933
934 return ret;
935 }
936
937 int suspend_science_tasks( void )
816 {
938 {
817 /** This function suspends the science tasks.
939 /** This function suspends the science tasks.
818 *
940 *
@@ -948,6 +1070,99 int suspend_science_tasks()
948 return status;
1070 return status;
949 }
1071 }
950
1072
1073 int suspend_asm_tasks( void )
1074 {
1075 /** This function suspends the science tasks.
1076 *
1077 * @return RTEMS directive status codes:
1078 * - RTEMS_SUCCESSFUL - task restarted successfully
1079 * - RTEMS_INVALID_ID - task id invalid
1080 * - RTEMS_ALREADY_SUSPENDED - task already suspended
1081 *
1082 */
1083
1084 rtems_status_code status;
1085
1086 PRINTF("in suspend_science_tasks\n")
1087
1088 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
1089 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
1090 {
1091 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
1092 }
1093 else
1094 {
1095 status = RTEMS_SUCCESSFUL;
1096 }
1097
1098 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
1099 {
1100 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
1101 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
1102 {
1103 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
1104 }
1105 else
1106 {
1107 status = RTEMS_SUCCESSFUL;
1108 }
1109 }
1110
1111 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
1112 {
1113 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
1114 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
1115 {
1116 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
1117 }
1118 else
1119 {
1120 status = RTEMS_SUCCESSFUL;
1121 }
1122 }
1123
1124 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
1125 {
1126 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
1127 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
1128 {
1129 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
1130 }
1131 else
1132 {
1133 status = RTEMS_SUCCESSFUL;
1134 }
1135 }
1136
1137 if (status == RTEMS_SUCCESSFUL) // suspend AVF2
1138 {
1139 status = rtems_task_suspend( Task_id[TASKID_AVF2] );
1140 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
1141 {
1142 PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
1143 }
1144 else
1145 {
1146 status = RTEMS_SUCCESSFUL;
1147 }
1148 }
1149
1150 if (status == RTEMS_SUCCESSFUL) // suspend PRC2
1151 {
1152 status = rtems_task_suspend( Task_id[TASKID_PRC2] );
1153 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
1154 {
1155 PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
1156 }
1157 else
1158 {
1159 status = RTEMS_SUCCESSFUL;
1160 }
1161 }
1162
1163 return status;
1164 }
1165
951 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
1166 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
952 {
1167 {
953 WFP_reset_current_ring_nodes();
1168 WFP_reset_current_ring_nodes();
@@ -985,18 +1200,6 void launch_spectral_matrix( void )
985
1200
986 }
1201 }
987
1202
988 void launch_spectral_matrix_simu( void )
989 {
990 SM_reset_current_ring_nodes();
991 reset_spectral_matrix_regs();
992 reset_nb_sm();
993
994 // Spectral Matrices simulator
995 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
996 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
997 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
998 }
999
1000 void set_sm_irq_onNewMatrix( unsigned char value )
1203 void set_sm_irq_onNewMatrix( unsigned char value )
1001 {
1204 {
1002 if (value == 1)
1205 if (value == 1)
@@ -31,13 +31,17 ring_node *current_ring_node_f3;
31 ring_node *ring_node_to_send_cwf_f3;
31 ring_node *ring_node_to_send_cwf_f3;
32 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK ];
32 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK ];
33
33
34 bool extractSWF = false;
34 bool extractSWF1 = false;
35 bool swf_f0_ready = false;
35 bool extractSWF2 = false;
36 bool swf_f1_ready = false;
36 bool swf0_ready_flag_f1 = false;
37 bool swf_f2_ready = false;
37 bool swf0_ready_flag_f2 = false;
38 bool swf1_ready = false;
39 bool swf2_ready = false;
38
40
39 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) ];
41 int swf1_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) ];
40 ring_node ring_node_wf_snap_extracted;
42 int swf2_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) ];
43 ring_node ring_node_swf1_extracted;
44 ring_node ring_node_swf2_extracted;
41
45
42 //*********************
46 //*********************
43 // Interrupt SubRoutine
47 // Interrupt SubRoutine
@@ -88,10 +92,12 ring_node * getRingNodeToSendSWF( unsign
88
92
89 void reset_extractSWF( void )
93 void reset_extractSWF( void )
90 {
94 {
91 extractSWF = false;
95 extractSWF1 = false;
92 swf_f0_ready = false;
96 extractSWF2 = false;
93 swf_f1_ready = false;
97 swf0_ready_flag_f1 = false;
94 swf_f2_ready = false;
98 swf0_ready_flag_f2 = false;
99 swf1_ready = false;
100 swf2_ready = false;
95 }
101 }
96
102
97 inline void waveforms_isr_f3( void )
103 inline void waveforms_isr_f3( void )
@@ -125,80 +131,6 inline void waveforms_isr_f3( void )
125 }
131 }
126 }
132 }
127
133
128 inline void waveforms_isr_normal( void )
129 {
130 rtems_status_code status;
131
132 if ( ( (waveform_picker_regs->status & 0x30) != 0x00 ) // [0011 0000] check the f2 full bits
133 && ( (waveform_picker_regs->status & 0x0c) != 0x00 ) // [0000 1100] check the f1 full bits
134 && ( (waveform_picker_regs->status & 0x03) != 0x00 )) // [0000 0011] check the f0 full bits
135 {
136 //***
137 // F0
138 ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
139 current_ring_node_f0 = current_ring_node_f0->next;
140 if ( (waveform_picker_regs->status & 0x01) == 0x01)
141 {
142
143 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
144 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
145 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
146 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
147 }
148 else if ( (waveform_picker_regs->status & 0x02) == 0x02)
149 {
150 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
151 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
152 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
153 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
154 }
155
156 //***
157 // F1
158 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
159 current_ring_node_f1 = current_ring_node_f1->next;
160 if ( (waveform_picker_regs->status & 0x04) == 0x04)
161 {
162 ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time;
163 ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time;
164 waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
165 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0
166 }
167 else if ( (waveform_picker_regs->status & 0x08) == 0x08)
168 {
169 ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time;
170 ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time;
171 waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
172 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
173 }
174
175 //***
176 // F2
177 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
178 current_ring_node_f2 = current_ring_node_f2->next;
179 if ( (waveform_picker_regs->status & 0x10) == 0x10)
180 {
181 ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
182 ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
183 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
184 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
185 }
186 else if ( (waveform_picker_regs->status & 0x20) == 0x20)
187 {
188 ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
189 ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
190 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
191 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
192 }
193 //
194 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL );
195 if ( status != RTEMS_SUCCESSFUL)
196 {
197 status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
198 }
199 }
200 }
201
202 inline void waveforms_isr_burst( void )
134 inline void waveforms_isr_burst( void )
203 {
135 {
204 unsigned char status;
136 unsigned char status;
@@ -238,11 +170,36 inline void waveforms_isr_burst( void )
238 }
170 }
239 }
171 }
240
172
241 inline void waveforms_isr_sbm1( void )
173 inline void waveform_isr_normal_sbm1_sbm2( void )
242 {
174 {
243 rtems_status_code status;
175 rtems_status_code status;
244
176
245 //***
177 //***
178 // F0
179 if ( (waveform_picker_regs->status & 0x03) != 0x00 ) // [0000 0011] check the f0 full bits
180 {
181 swf0_ready_flag_f1 = true;
182 swf0_ready_flag_f2 = true;
183 ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
184 current_ring_node_f0 = current_ring_node_f0->next;
185 if ( (waveform_picker_regs->status & 0x01) == 0x01)
186 {
187
188 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
189 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
190 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
191 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
192 }
193 else if ( (waveform_picker_regs->status & 0x02) == 0x02)
194 {
195 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
196 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
197 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
198 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
199 }
200 }
201
202 //***
246 // F1
203 // F1
247 if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bits
204 if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bits
248 // (1) change the receiving buffer for the waveform picker
205 // (1) change the receiving buffer for the waveform picker
@@ -263,63 +220,11 inline void waveforms_isr_sbm1( void )
263 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
220 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
264 }
221 }
265 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
222 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
266 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
223 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_NORM_S1_S2 );
267 }
268
269 //***
270 // F0
271 if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bits
272 swf_f0_ready = true;
273 // change f0 buffer
274 ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
275 current_ring_node_f0 = current_ring_node_f0->next;
276 if ( (waveform_picker_regs->status & 0x01) == 0x01)
277 {
278
279 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
280 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
281 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
282 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
283 }
284 else if ( (waveform_picker_regs->status & 0x02) == 0x02)
285 {
286 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
287 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
288 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
289 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
290 }
291 }
224 }
292
225
293 //***
226 //***
294 // F2
227 // F2
295 if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bits
296 swf_f2_ready = true;
297 // change f2 buffer
298 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
299 current_ring_node_f2 = current_ring_node_f2->next;
300 if ( (waveform_picker_regs->status & 0x10) == 0x10)
301 {
302 ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
303 ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
304 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
305 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
306 }
307 else if ( (waveform_picker_regs->status & 0x20) == 0x20)
308 {
309 ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
310 ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
311 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
312 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
313 }
314 }
315 }
316
317 inline void waveforms_isr_sbm2( void )
318 {
319 rtems_status_code status;
320
321 //***
322 // F2
323 if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bit
228 if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bit
324 // (1) change the receiving buffer for the waveform picker
229 // (1) change the receiving buffer for the waveform picker
325 ring_node_to_send_cwf_f2 = current_ring_node_f2->previous;
230 ring_node_to_send_cwf_f2 = current_ring_node_f2->previous;
@@ -340,53 +245,7 inline void waveforms_isr_sbm2( void )
340 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
245 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
341 }
246 }
342 // (2) send an event for the waveforms transmission
247 // (2) send an event for the waveforms transmission
343 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
248 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_NORM_S1_S2 );
344 }
345
346 //***
347 // F0
348 if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bit
349 swf_f0_ready = true;
350 // change f0 buffer
351 ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
352 current_ring_node_f0 = current_ring_node_f0->next;
353 if ( (waveform_picker_regs->status & 0x01) == 0x01)
354 {
355
356 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
357 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
358 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
359 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
360 }
361 else if ( (waveform_picker_regs->status & 0x02) == 0x02)
362 {
363 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
364 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
365 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
366 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
367 }
368 }
369
370 //***
371 // F1
372 if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bit
373 swf_f1_ready = true;
374 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
375 current_ring_node_f1 = current_ring_node_f1->next;
376 if ( (waveform_picker_regs->status & 0x04) == 0x04)
377 {
378 ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time;
379 ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time;
380 waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
381 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0
382 }
383 else if ( (waveform_picker_regs->status & 0x08) == 0x08)
384 {
385 ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time;
386 ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time;
387 waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
388 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
389 }
390 }
249 }
391 }
250 }
392
251
@@ -420,38 +279,25 rtems_isr waveforms_isr( rtems_vector_nu
420
279
421 switch(lfrCurrentMode)
280 switch(lfrCurrentMode)
422 {
281 {
423 //********
282 //********
424 // STANDBY
283 // STANDBY
425 case(LFR_MODE_STANDBY):
284 case LFR_MODE_STANDBY:
426 break;
285 break;
427
286 //**************************
428 //******
287 // LFR NORMAL, SBM1 and SBM2
429 // NORMAL
288 case LFR_MODE_NORMAL:
430 case(LFR_MODE_NORMAL):
289 case LFR_MODE_SBM1:
431 waveforms_isr_normal();
290 case LFR_MODE_SBM2:
291 waveform_isr_normal_sbm1_sbm2();
432 break;
292 break;
433
293 //******
434 //******
294 // BURST
435 // BURST
295 case LFR_MODE_BURST:
436 case(LFR_MODE_BURST):
437 waveforms_isr_burst();
296 waveforms_isr_burst();
438 break;
297 break;
439
298 //********
440 //*****
299 // DEFAULT
441 // SBM1
300 default:
442 case(LFR_MODE_SBM1):
443 waveforms_isr_sbm1();
444 break;
445
446 //*****
447 // SBM2
448 case(LFR_MODE_SBM2):
449 waveforms_isr_sbm2();
450 break;
451
452 //********
453 // DEFAULT
454 default:
455 break;
301 break;
456 }
302 }
457 }
303 }
@@ -476,9 +322,11 rtems_task wfrm_task(rtems_task_argument
476 rtems_id queue_id;
322 rtems_id queue_id;
477 rtems_status_code status;
323 rtems_status_code status;
478 bool resynchronisationEngaged;
324 bool resynchronisationEngaged;
479 ring_node *ring_node_wf_snap_extracted_ptr;
325 ring_node *ring_node_swf1_extracted_ptr;
326 ring_node *ring_node_swf2_extracted_ptr;
480
327
481 ring_node_wf_snap_extracted_ptr = (ring_node *) &ring_node_wf_snap_extracted;
328 ring_node_swf1_extracted_ptr = (ring_node *) &ring_node_swf1_extracted;
329 ring_node_swf2_extracted_ptr = (ring_node *) &ring_node_swf2_extracted;
482
330
483 resynchronisationEngaged = false;
331 resynchronisationEngaged = false;
484
332
@@ -490,10 +338,9 rtems_task wfrm_task(rtems_task_argument
490
338
491 BOOT_PRINTF("in WFRM ***\n")
339 BOOT_PRINTF("in WFRM ***\n")
492
340
493 while(1){
341 while(1){
494 // wait for an RTEMS_EVENT
342 // wait for an RTEMS_EVENT
495 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
343 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL,
496 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
497 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
344 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
498 if(resynchronisationEngaged == false)
345 if(resynchronisationEngaged == false)
499 { // engage resynchronisation
346 { // engage resynchronisation
@@ -503,40 +350,19 rtems_task wfrm_task(rtems_task_argument
503 else
350 else
504 { // reset delta_snapshot to the nominal value
351 { // reset delta_snapshot to the nominal value
505 PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n")
352 PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n")
506 set_wfp_delta_snapshot();
353 set_wfp_delta_snapshot();
507 resynchronisationEngaged = false;
354 resynchronisationEngaged = false;
508 }
355 }
509 //
356 //
510
511 if (event_out == RTEMS_EVENT_MODE_NORMAL)
357 if (event_out == RTEMS_EVENT_MODE_NORMAL)
512