Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define DEFAULT_CRYSTAL_FREQUENCY 28800000
- // Osmocom
- #define FREQ_USE_THREE_PHASE_BELOW 350000000
- #define _GR_BAZ_VCO_BUG_ 0
- // Gr-Baz
- //#define FREQ_USE_THREE_PHASE_BELOW 300000000
- //#define _GR_BAZ_VCO_BUG_ 1
- void dump_pll_valid_range()
- {
- uint32_t fosc = DEFAULT_CRYSTAL_FREQUENCY;
- int i=0;
- int three_phase = 0;
- for (three_phase = 0; three_phase < 2; three_phase ++)
- {
- fprintf(stderr,
- "%s phase.\n",
- three_phase ? "Three (3)" : "Two (2)");
- for (i=0; i< ARRAY_SIZE(vco_r_table_3ph);i++)
- {
- int r = vco_r_table_3ph[i];
- if (!three_phase)
- r = r / 2;
- uint64_t fvco_min = E4K_FVCO_MIN / r;
- uint64_t fvco_max = E4K_FVCO_MAX / r;
- if (three_phase && fvco_max >= FREQ_USE_THREE_PHASE_BELOW)
- {
- fvco_max = FREQ_USE_THREE_PHASE_BELOW - 1;
- }
- if (!three_phase && fvco_min < FREQ_USE_THREE_PHASE_BELOW)
- {
- fvco_min = FREQ_USE_THREE_PHASE_BELOW;
- }
- if (!three_phase && fvco_max < FREQ_USE_THREE_PHASE_BELOW)
- {
- /* Skip this entire R value, falling below the cut-off,
- * performed the output for this frequency range
- * when three_phase = 1 */
- continue;
- }
- uint32_t z = fvco_min / fosc;
- if (!is_z_valid(z))
- {
- fprintf(stderr, "Range (r =%3d) unavailable, z too high (%u)\n", r, z);
- continue;
- }
- #if _GR_BAZ_VCO_BUG_
- uint64_t fvco_z = z * fosc;
- uint64_t remainder = fvco_min - fvco_z;
- if (remainder)
- {
- if (!is_z_valid(z+1))
- {
- fprintf(stderr, "Range (r =%3d) empty, z+1 too high (%u)+1\n", r, z);
- continue;
- }
- fvco_min = (z + 1) * fosc;
- }
- #endif
- if (three_phase && fvco_min >= FREQ_USE_THREE_PHASE_BELOW)
- {
- /* Try next R value. */
- continue;
- }
- fprintf(stderr,
- "r =%3d: %20llu..%llu\n",
- r,
- fvco_min,
- fvco_max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement