FreeCalypso > hg > tcs211-l1-reconst
comparison chipsetsw/layer1/cfile/l1_pwmgr.c @ 125:813c4bb83603
l1_pwmgr.c: l1ctl_gauging() reconstructed
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Fri, 13 May 2016 07:38:14 +0000 |
parents | 190c68fa5689 |
children | c0a6b2f9723b |
comparison
equal
deleted
inserted
replaced
124:190c68fa5689 | 125:813c4bb83603 |
---|---|
1074 static UWORD8 bad_count; // bad gauging values | 1074 static UWORD8 bad_count; // bad gauging values |
1075 static UWORD8 gauging_state= RESET; // RESET,INIT, ACQUIS, UPDATE | 1075 static UWORD8 gauging_state= RESET; // RESET,INIT, ACQUIS, UPDATE |
1076 static UWORD8 nb_gaug; // number of gauging in ACQUIS | 1076 static UWORD8 nb_gaug; // number of gauging in ACQUIS |
1077 static UWORD8 idx,i; // index | 1077 static UWORD8 idx,i; // index |
1078 static UWORD32 root, frac; // ratio of HF and LF average | 1078 static UWORD32 root, frac; // ratio of HF and LF average |
1079 UWORD32 sumLF=0 , sumHF=0; // sum of HF and LF counts | 1079 UWORD32 sumLF, sumHF; // sum of HF and LF counts |
1080 double nbHF_theo; | 1080 double nbHF_theo; |
1081 | 1081 |
1082 | 1082 |
1083 // AFC or TEMPERATURE variation | 1083 // AFC or TEMPERATURE variation |
1084 | 1084 |
1131 // compute clocks ratio from measurements. | 1131 // compute clocks ratio from measurements. |
1132 RATIO(nb_hf,nb_32khz,root,frac) | 1132 RATIO(nb_hf,nb_32khz,root,frac) |
1133 | 1133 |
1134 | 1134 |
1135 // allow [-500ppm,+100ppm] derive on 32Khz at startup. | 1135 // allow [-500ppm,+100ppm] derive on 32Khz at startup. |
1136 // Commenting section below for OMAPS00148004 | 1136 #if 0 /* really old code, apparently */ |
1137 /* if ( | 1137 if ( |
1138 (root > l1s.pw_mgr.c_clk_min || | 1138 (root > l1s.pw_mgr.c_clk_min || |
1139 (root == l1s.pw_mgr.c_clk_min && | 1139 (root == l1s.pw_mgr.c_clk_min && |
1140 frac >= l1s.pw_mgr.c_clk_init_min) ) && | 1140 frac >= l1s.pw_mgr.c_clk_init_min) ) && |
1141 (root < l1s.pw_mgr.c_clk_max || | 1141 (root < l1s.pw_mgr.c_clk_max || |
1142 (root == l1s.pw_mgr.c_clk_max && | 1142 (root == l1s.pw_mgr.c_clk_max && |
1143 frac <= l1s.pw_mgr.c_clk_init_max ) ) | 1143 frac <= l1s.pw_mgr.c_clk_init_max ) ) |
1144 */ | 1144 #elif 1 /* TCS211 reconstruction */ |
1145 if ( | |
1146 (root == l1s.pw_mgr.c_clk_min && | |
1147 frac >= l1s.pw_mgr.c_clk_init_min ) || | |
1148 (root == l1s.pw_mgr.c_clk_max && | |
1149 frac <= l1s.pw_mgr.c_clk_init_max ) | |
1150 #else /* LoCosto code */ | |
1145 if ( | 1151 if ( |
1146 ( l1s.pw_mgr.c_clk_min == l1s.pw_mgr.c_clk_max && | 1152 ( l1s.pw_mgr.c_clk_min == l1s.pw_mgr.c_clk_max && |
1147 frac >= l1s.pw_mgr.c_clk_init_min && | 1153 frac >= l1s.pw_mgr.c_clk_init_min && |
1148 frac <= l1s.pw_mgr.c_clk_init_max ) | 1154 frac <= l1s.pw_mgr.c_clk_init_max ) |
1149 || | 1155 || |
1152 frac >= l1s.pw_mgr.c_clk_init_min ) || | 1158 frac >= l1s.pw_mgr.c_clk_init_min ) || |
1153 (root > l1s.pw_mgr.c_clk_min && | 1159 (root > l1s.pw_mgr.c_clk_min && |
1154 root < l1s.pw_mgr.c_clk_max ) || | 1160 root < l1s.pw_mgr.c_clk_max ) || |
1155 (root == l1s.pw_mgr.c_clk_max && | 1161 (root == l1s.pw_mgr.c_clk_max && |
1156 frac <= l1s.pw_mgr.c_clk_init_max ) ) ) | 1162 frac <= l1s.pw_mgr.c_clk_init_max ) ) ) |
1163 #endif | |
1157 ) | 1164 ) |
1158 { | 1165 { |
1159 l1s.pw_mgr.histo[idx ][0] = nb_32khz; // init histo with the number of 32kHz | 1166 l1s.pw_mgr.histo[idx ][0] = nb_32khz; // init histo with the number of 32kHz |
1160 l1s.pw_mgr.histo[idx++][1] = nb_hf; // init histo with the number of hf (13Mhz) | 1167 l1s.pw_mgr.histo[idx++][1] = nb_hf; // init histo with the number of hf (13Mhz) |
1161 | 1168 |
1272 l1s.pw_mgr.state = gauging_state; | 1279 l1s.pw_mgr.state = gauging_state; |
1273 l1s.pw_mgr.lf = nb_32khz ; | 1280 l1s.pw_mgr.lf = nb_32khz ; |
1274 // WARNING WARNING, this case gauging_state == UPDATE modify the algo. | 1281 // WARNING WARNING, this case gauging_state == UPDATE modify the algo. |
1275 // In case of trace the parameter root and frac are refresh. | 1282 // In case of trace the parameter root and frac are refresh. |
1276 // it is not the case if no trace and it seems there is mistake | 1283 // it is not the case if no trace and it seems there is mistake |
1284 #if 0 /* FreeCalypso TCS211 reconstruction */ | |
1277 if (gauging_state == UPDATE) | 1285 if (gauging_state == UPDATE) |
1278 { | 1286 { |
1279 RATIO2(sumHF,sumLF,root,frac); | 1287 RATIO2(sumHF,sumLF,root,frac); |
1280 } | 1288 } |
1289 #endif | |
1281 //End of Warning. | 1290 //End of Warning. |
1282 l1s.pw_mgr.hf = nb_hf ; | 1291 l1s.pw_mgr.hf = nb_hf ; |
1283 l1s.pw_mgr.root = root ; | 1292 l1s.pw_mgr.root = root ; |
1284 l1s.pw_mgr.frac = frac ; | 1293 l1s.pw_mgr.frac = frac ; |
1285 #endif // End Trace gauging | 1294 #endif // End Trace gauging |