##// 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 );
@@ -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.
@@ -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:
@@ -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
@@ -422,33 +281,20 rtems_isr waveforms_isr( rtems_vector_nu
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
434 //******
293 //******
435 // BURST
294 // BURST
436 case(LFR_MODE_BURST):
295 case LFR_MODE_BURST:
437 waveforms_isr_burst();
296 waveforms_isr_burst();
438 break;
297 break;
439
440 //*****
441 // SBM1
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 //********
298 //********
453 // DEFAULT
299 // DEFAULT
454 default:
300 default:
@@ -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
@@ -492,8 +340,7 rtems_task wfrm_task(rtems_task_argument
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
@@ -507,36 +354,15 rtems_task wfrm_task(rtems_task_argument
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 {
358 {
513 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
514 ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0;
515 ring_node_to_send_swf_f1->sid = SID_NORM_SWF_F1;
516 ring_node_to_send_swf_f2->sid = SID_NORM_SWF_F2;
517 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) );
518 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f1, sizeof( ring_node* ) );
519 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f2, sizeof( ring_node* ) );
520 }
521 if (event_out == RTEMS_EVENT_MODE_SBM1)
522 {
523 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
524 ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0;
525 ring_node_wf_snap_extracted_ptr->sid = SID_NORM_SWF_F1;
526 ring_node_to_send_swf_f2->sid = SID_NORM_SWF_F2;
527 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) );
528 status = rtems_message_queue_send( queue_id, &ring_node_wf_snap_extracted_ptr, sizeof( ring_node* ) );
529 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f2, sizeof( ring_node* ) );
530 }
531 if (event_out == RTEMS_EVENT_MODE_SBM2)
532 {
533 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
359 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
534 ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0;
360 ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0;
535 ring_node_to_send_swf_f1->sid = SID_NORM_SWF_F1;
361 ring_node_swf1_extracted_ptr->sid = SID_NORM_SWF_F1;
536 ring_node_wf_snap_extracted_ptr->sid = SID_NORM_SWF_F2;
362 ring_node_swf2_extracted_ptr->sid = SID_NORM_SWF_F2;
537 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) );
363 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) );
538 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f1, sizeof( ring_node* ) );
364 status = rtems_message_queue_send( queue_id, &ring_node_swf1_extracted_ptr, sizeof( ring_node* ) );
539 status = rtems_message_queue_send( queue_id, &ring_node_wf_snap_extracted_ptr, sizeof( ring_node* ) );
365 status = rtems_message_queue_send( queue_id, &ring_node_swf2_extracted_ptr, sizeof( ring_node* ) );
540 }
366 }
541 }
367 }
542 }
368 }
@@ -635,33 +461,37 rtems_task cwf2_task(rtems_task_argument
635
461
636 while(1){
462 while(1){
637 // wait for an RTEMS_EVENT
463 // wait for an RTEMS_EVENT
638 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
464 rtems_event_receive( RTEMS_EVENT_MODE_NORM_S1_S2 | RTEMS_EVENT_MODE_BURST,
639 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
465 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
640 ring_node_to_send = getRingNodeToSendCWF( 2 );
466 ring_node_to_send = getRingNodeToSendCWF( 2 );
641 if (event_out == RTEMS_EVENT_MODE_BURST)
467 if (event_out == RTEMS_EVENT_MODE_BURST)
642 {
468 {
643 status = rtems_message_queue_send( queue_id, &ring_node_to_send, sizeof( ring_node* ) );
469 status = rtems_message_queue_send( queue_id, &ring_node_to_send, sizeof( ring_node* ) );
644 }
470 }
645 if (event_out == RTEMS_EVENT_MODE_SBM2)
471 else if (event_out == RTEMS_EVENT_MODE_NORM_S1_S2)
472 {
473 if ( lfrCurrentMode == LFR_MODE_SBM2 )
646 {
474 {
647 status = rtems_message_queue_send( queue_id, &ring_node_to_send, sizeof( ring_node* ) );
475 status = rtems_message_queue_send( queue_id, &ring_node_to_send, sizeof( ring_node* ) );
476 }
648 // launch snapshot extraction if needed
477 // launch snapshot extraction if needed
649 if (extractSWF == true)
478 if (extractSWF2 == true)
650 {
479 {
651 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
480 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
652 // extract the snapshot
481 // extract the snapshot
653 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2, acquisitionTimeF0_asLong );
482 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2, acquisitionTimeF0_asLong,
483 &ring_node_swf2_extracted, swf2_extracted );
654 // send the snapshot when built
484 // send the snapshot when built
655 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
485 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
656 extractSWF = false;
486 extractSWF2 = false;
487 swf2_ready = true;
657 }
488 }
658 if (swf_f0_ready && swf_f1_ready)
489 if (swf0_ready_flag_f2 == true)
659 {
490 {
660 extractSWF = true;
491 extractSWF2 = true;
661 // record the acquition time of the fΓ  snapshot to use to build the snapshot at f2
492 // record the acquition time of the f0 snapshot to use to build the snapshot at f2
662 acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send_swf_f0->coarseTime );
493 acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send_swf_f0->coarseTime );
663 swf_f0_ready = false;
494 swf0_ready_flag_f2 = false;
664 swf_f1_ready = false;
665 }
495 }
666 }
496 }
667 }
497 }
@@ -694,33 +524,36 rtems_task cwf1_task(rtems_task_argument
694
524
695 while(1){
525 while(1){
696 // wait for an RTEMS_EVENT
526 // wait for an RTEMS_EVENT
697 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
527 rtems_event_receive( RTEMS_EVENT_MODE_NORM_S1_S2,
698 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
528 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
699 ring_node_to_send_cwf = getRingNodeToSendCWF( 1 );
529 ring_node_to_send_cwf = getRingNodeToSendCWF( 1 );
700 ring_node_to_send_cwf_f1->sid = SID_SBM1_CWF_F1;
530 ring_node_to_send_cwf_f1->sid = SID_SBM1_CWF_F1;
531 if (lfrCurrentMode == LFR_MODE_SBM1)
532 {
701 status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf, sizeof( ring_node* ) );
533 status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf, sizeof( ring_node* ) );
702 if (status != 0)
534 if (status != 0)
703 {
535 {
704 PRINTF("cwf sending failed\n")
536 PRINTF("cwf sending failed\n")
705 }
537 }
538 }
706 // launch snapshot extraction if needed
539 // launch snapshot extraction if needed
707 if (extractSWF == true)
540 if (extractSWF1 == true)
708 {
541 {
709 ring_node_to_send_swf_f1 = ring_node_to_send_cwf;
542 ring_node_to_send_swf_f1 = ring_node_to_send_cwf;
710 // launch the snapshot extraction
543 // launch the snapshot extraction
711 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
544 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_NORM_S1_S2 );
712 extractSWF = false;
545 extractSWF1 = false;
713 }
546 }
714 if (swf_f0_ready == true)
547 if (swf0_ready_flag_f1 == true)
715 {
548 {
716 extractSWF = true;
549 extractSWF1 = true;
717 swf_f0_ready = false; // this step shall be executed only one time
550 swf0_ready_flag_f1 = false; // this step shall be executed only one time
718 }
551 }
719 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
552 if ((swf1_ready == true) && (swf2_ready == true)) // swf_f1 is ready after the extraction
720 {
553 {
721 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
554 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL );
722 swf_f1_ready = false;
555 swf1_ready = false;
723 swf_f2_ready = false;
556 swf2_ready = false;
724 }
557 }
725 }
558 }
726 }
559 }
@@ -742,13 +575,14 rtems_task swbd_task(rtems_task_argument
742
575
743 while(1){
576 while(1){
744 // wait for an RTEMS_EVENT
577 // wait for an RTEMS_EVENT
745 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
578 rtems_event_receive( RTEMS_EVENT_MODE_NORM_S1_S2,
746 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
579 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
747 if (event_out == RTEMS_EVENT_MODE_SBM1)
580 if (event_out == RTEMS_EVENT_MODE_NORM_S1_S2)
748 {
581 {
749 acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send_swf_f0->coarseTime );
582 acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send_swf_f0->coarseTime );
750 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1, acquisitionTimeF0_asLong );
583 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1, acquisitionTimeF0_asLong,
751 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
584 &ring_node_swf1_extracted, swf1_extracted );
585 swf1_ready = true; // the snapshot has been extracted and is ready to be sent
752 }
586 }
753 else
587 else
754 {
588 {
@@ -771,7 +605,8 void WFP_init_rings( void )
771 // F3 RING
605 // F3 RING
772 init_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_buffer_f3, WFRM_BUFFER );
606 init_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_buffer_f3, WFRM_BUFFER );
773
607
774 ring_node_wf_snap_extracted.buffer_address = (int) wf_snap_extracted;
608 ring_node_swf1_extracted.buffer_address = (int) swf1_extracted;
609 ring_node_swf2_extracted.buffer_address = (int) swf2_extracted;
775
610
776 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
611 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
777 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
612 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
@@ -924,7 +759,11 void compute_acquisition_time( unsigned
924
759
925 }
760 }
926
761
927 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel, unsigned long long int acquisitionTimeF0_asLong )
762 void build_snapshot_from_ring( ring_node *ring_node_to_send,
763 unsigned char frequencyChannel,
764 unsigned long long int acquisitionTimeF0_asLong,
765 ring_node *ring_node_swf_extracted,
766 int *swf_extracted)
928 {
767 {
929 unsigned int i;
768 unsigned int i;
930 unsigned long long int centerTime_asLong;
769 unsigned long long int centerTime_asLong;
@@ -1001,11 +840,11 void build_snapshot_from_ring( ring_node
1001 // (7) copy the acquisition time at the beginning of the extrated snapshot
840 // (7) copy the acquisition time at the beginning of the extrated snapshot
1002 ptr1 = (unsigned char*) &acquisitionTime_asLong;
841 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1003 // fine time
842 // fine time
1004 ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.fineTime;
843 ptr2 = (unsigned char*) &ring_node_swf_extracted->fineTime;
1005 ptr2[2] = ptr1[ 4 + 2 ];
844 ptr2[2] = ptr1[ 4 + 2 ];
1006 ptr2[3] = ptr1[ 5 + 2 ];
845 ptr2[3] = ptr1[ 5 + 2 ];
1007 // coarse time
846 // coarse time
1008 ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.coarseTime;
847 ptr2 = (unsigned char*) &ring_node_swf_extracted->coarseTime;
1009 ptr2[0] = ptr1[ 0 + 2 ];
848 ptr2[0] = ptr1[ 0 + 2 ];
1010 ptr2[1] = ptr1[ 1 + 2 ];
849 ptr2[1] = ptr1[ 1 + 2 ];
1011 ptr2[2] = ptr1[ 2 + 2 ];
850 ptr2[2] = ptr1[ 2 + 2 ];
@@ -1022,14 +861,14 void build_snapshot_from_ring( ring_node
1022 // copy the part 1 of the snapshot in the extracted buffer
861 // copy the part 1 of the snapshot in the extracted buffer
1023 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
862 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1024 {
863 {
1025 wf_snap_extracted[i] =
864 swf_extracted[i] =
1026 ((int*) ring_node_to_send->buffer_address)[ i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) ];
865 ((int*) ring_node_to_send->buffer_address)[ i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) ];
1027 }
866 }
1028 // copy the part 2 of the snapshot in the extracted buffer
867 // copy the part 2 of the snapshot in the extracted buffer
1029 ring_node_to_send = ring_node_to_send->next;
868 ring_node_to_send = ring_node_to_send->next;
1030 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
869 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1031 {
870 {
1032 wf_snap_extracted[i] =
871 swf_extracted[i] =
1033 ((int*) ring_node_to_send->buffer_address)[ (i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) ];
872 ((int*) ring_node_to_send->buffer_address)[ (i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) ];
1034 }
873 }
1035 }
874 }
@@ -1211,21 +1050,15 void set_wfp_burst_enable_register( unsi
1211 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1050 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1212 // the burst bits shall be set first, before the enable bits
1051 // the burst bits shall be set first, before the enable bits
1213 switch(mode) {
1052 switch(mode) {
1214 case(LFR_MODE_NORMAL):
1053 case LFR_MODE_NORMAL:
1215 waveform_picker_regs->run_burst_enable = 0x60; // [0110 0000] enable f2 AND f1 burst
1054 case LFR_MODE_SBM1:
1216 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1111] enable f3 f2 f1 f0
1055 case LFR_MODE_SBM2:
1217 break;
1056 waveform_picker_regs->run_burst_enable = 0x60; // [0110 0000] enable f2 and f1 burst
1218 case(LFR_MODE_BURST):
1219 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1220 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1221 break;
1222 case(LFR_MODE_SBM1):
1223 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1224 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1057 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1225 break;
1058 break;
1226 case(LFR_MODE_SBM2):
1059 case LFR_MODE_BURST:
1227 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1060 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1228 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1061 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 and f2
1229 break;
1062 break;
1230 default:
1063 default:
1231 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1064 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
General Comments 0
You need to be logged in to leave comments. Login now