@@ -43,6 +43,13 int swf2_extracted[ (NB_SAMPLES_PER_SNAP | |||
|
43 | 43 | ring_node ring_node_swf1_extracted; |
|
44 | 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 | 54 | // Interrupt SubRoutine |
|
48 | 55 | |
@@ -873,6 +880,9 void snapshot_resynchronization( unsigne | |||
|
873 | 880 | double deltaPrevious_ms; |
|
874 | 881 | double deltaNext_ms; |
|
875 | 882 | double correctionInF2; |
|
883 | double center_k = 0.; | |
|
884 | double cnter_k_plus_1 = 0.; | |
|
885 | static resynchro_state state = IDLE; | |
|
876 | 886 | static unsigned char resynchroEngaged = 0; |
|
877 | 887 | |
|
878 | 888 | if (resynchroEngaged == 0) |
@@ -909,13 +919,14 void snapshot_resynchronization( unsigne | |||
|
909 | 919 | |
|
910 | 920 | if (correctionInF2 >=0 ) |
|
911 | 921 | { |
|
912 |
deltaTickInF2 = |
|
|
922 | deltaTickInF2 = ceil( correctionInF2 ); | |
|
913 | 923 | } |
|
914 | 924 | else |
|
915 | 925 | { |
|
916 |
deltaTickInF2 = |
|
|
926 | deltaTickInF2 = floor( correctionInF2 ); | |
|
917 | 927 | } |
|
918 | 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 | 930 | PRINTF2("Correction of = %d, delta_snapshot = %d\n\n", deltaTickInF2, waveform_picker_regs->delta_snapshot); |
|
920 | 931 | } |
|
921 | 932 | else |
@@ -981,7 +992,7 void reset_waveform_picker_regs( void ) | |||
|
981 | 992 | * - 0x1C delta_snapshot |
|
982 | 993 | * - 0x20 delta_f0 |
|
983 | 994 | * - 0x24 delta_f0_2 |
|
984 | * - 0x28 delta_f1 | |
|
995 | * - 0x28 delta_f1 (obsolet parameter) | |
|
985 | 996 | * - 0x2c delta_f2 |
|
986 | 997 | * - 0x30 nb_data_by_buffer |
|
987 | 998 | * - 0x34 nb_snapshot_param |
@@ -1002,15 +1013,15 void reset_waveform_picker_regs( void ) | |||
|
1002 | 1013 | |
|
1003 | 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 | 1018 | set_wfp_delta_f2(); // 0x2c |
|
1008 | 1019 | |
|
1009 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) | |
|
1010 |
|
|
|
1011 |
|
|
|
1012 |
|
|
|
1013 |
|
|
|
1020 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot); | |
|
1021 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0); | |
|
1022 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2); | |
|
1023 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1); | |
|
1024 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2); | |
|
1014 | 1025 |
|
|
1015 | 1026 |
|
|
1016 | 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 | 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 | 1135 | unsigned int delta_snapshot; |
|
1115 | 1136 | unsigned int nb_samples_per_snapshot; |
|
1116 | 1137 | float delta_f1_in_float; |
@@ -1122,8 +1143,19 void set_wfp_delta_f1( void ) | |||
|
1122 | 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 | 1159 | unsigned int delta_snapshot; |
|
1128 | 1160 | unsigned int nb_samples_per_snapshot; |
|
1129 | 1161 |
General Comments 0
You need to be logged in to leave comments.
Login now