##// END OF EJS Templates
Commit before changing the resynchro strategy
paul -
r256:f8034461b403 R3a
parent child
Show More
@@ -43,6 +43,13 int swf2_extracted[ (NB_SAMPLES_PER_SNAP
43 ring_node ring_node_swf1_extracted;
43 ring_node ring_node_swf1_extracted;
44 ring_node ring_node_swf2_extracted;
44 ring_node ring_node_swf2_extracted;
45
45
46 typedef enum resynchro_state_t
47 {
48 IDLE,
49 MEASURE_K,
50 MEASURE_K_PLUS_1,
51 } resynchro_state;
52
46 //*********************
53 //*********************
47 // Interrupt SubRoutine
54 // Interrupt SubRoutine
48
55
@@ -873,6 +880,9 void snapshot_resynchronization( unsigne
873 double deltaPrevious_ms;
880 double deltaPrevious_ms;
874 double deltaNext_ms;
881 double deltaNext_ms;
875 double correctionInF2;
882 double correctionInF2;
883 double center_k = 0.;
884 double cnter_k_plus_1 = 0.;
885 static resynchro_state state = IDLE;
876 static unsigned char resynchroEngaged = 0;
886 static unsigned char resynchroEngaged = 0;
877
887
878 if (resynchroEngaged == 0)
888 if (resynchroEngaged == 0)
@@ -909,13 +919,14 void snapshot_resynchronization( unsigne
909
919
910 if (correctionInF2 >=0 )
920 if (correctionInF2 >=0 )
911 {
921 {
912 deltaTickInF2 = floor( correctionInF2 );
922 deltaTickInF2 = ceil( correctionInF2 );
913 }
923 }
914 else
924 else
915 {
925 {
916 deltaTickInF2 = ceil( correctionInF2 );
926 deltaTickInF2 = floor( correctionInF2 );
917 }
927 }
918 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2;
928 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2;
929 set_wfp_delta_f0_f0_2(); // this is necessary to reset the value of delta_f0 as delta_snapshot has been changed
919 PRINTF2("Correction of = %d, delta_snapshot = %d\n\n", deltaTickInF2, waveform_picker_regs->delta_snapshot);
930 PRINTF2("Correction of = %d, delta_snapshot = %d\n\n", deltaTickInF2, waveform_picker_regs->delta_snapshot);
920 }
931 }
921 else
932 else
@@ -981,7 +992,7 void reset_waveform_picker_regs( void )
981 * - 0x1C delta_snapshot
992 * - 0x1C delta_snapshot
982 * - 0x20 delta_f0
993 * - 0x20 delta_f0
983 * - 0x24 delta_f0_2
994 * - 0x24 delta_f0_2
984 * - 0x28 delta_f1
995 * - 0x28 delta_f1 (obsolet parameter)
985 * - 0x2c delta_f2
996 * - 0x2c delta_f2
986 * - 0x30 nb_data_by_buffer
997 * - 0x30 nb_data_by_buffer
987 * - 0x34 nb_snapshot_param
998 * - 0x34 nb_snapshot_param
@@ -1002,15 +1013,15 void reset_waveform_picker_regs( void )
1002
1013
1003 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1014 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1004
1015
1005 set_wfp_delta_f1(); // 0x28
1016 //the parameter delta_f1 [0x28] is not used anymore
1006
1017
1007 set_wfp_delta_f2(); // 0x2c
1018 set_wfp_delta_f2(); // 0x2c
1008
1019
1009 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1020 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot);
1010 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1021 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0);
1011 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1022 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2);
1012 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1023 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1);
1013 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1024 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2);
1014 // 2688 = 8 * 336
1025 // 2688 = 8 * 336
1015 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1026 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1016 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1027 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
@@ -1111,6 +1122,16 void set_wfp_delta_f0_f0_2( void )
1111
1122
1112 void set_wfp_delta_f1( void )
1123 void set_wfp_delta_f1( void )
1113 {
1124 {
1125 /** Sets the value of the delta_f1 parameter
1126 *
1127 * @param void
1128 *
1129 * @return void
1130 *
1131 * delta_f1 is not used, the snapshots are extracted from CWF_F1 waveforms.
1132 *
1133 */
1134
1114 unsigned int delta_snapshot;
1135 unsigned int delta_snapshot;
1115 unsigned int nb_samples_per_snapshot;
1136 unsigned int nb_samples_per_snapshot;
1116 float delta_f1_in_float;
1137 float delta_f1_in_float;
@@ -1122,8 +1143,19 void set_wfp_delta_f1( void )
1122 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1143 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1123 }
1144 }
1124
1145
1125 void set_wfp_delta_f2()
1146 void set_wfp_delta_f2( void ) // parameter not used, only delta_f0 and delta_f0_2 are used
1126 {
1147 {
1148 /** Sets the value of the delta_f2 parameter
1149 *
1150 * @param void
1151 *
1152 * @return void
1153 *
1154 * delta_f2 is used only for the first snapshot generation, even when the snapshots are extracted from CWF_F2
1155 * waveforms (see lpp_waveform_snapshot_controler.vhd for details).
1156 *
1157 */
1158
1127 unsigned int delta_snapshot;
1159 unsigned int delta_snapshot;
1128 unsigned int nb_samples_per_snapshot;
1160 unsigned int nb_samples_per_snapshot;
1129
1161
General Comments 0
You need to be logged in to leave comments. Login now