Commit 6dff78a3 authored by Tristan Gingold's avatar Tristan Gingold

cmd_ptrack.c: add stat and channel sub-commands

The enable subcommand is renamed to unfreeze
parent 2c7f5594
......@@ -20,9 +20,11 @@
static const char * const ptrack_cmds[] =
{
"enable",
"ps-freeze",
"vco-freeze"
"unfreeze",
"ps-freeze",
"vco-freeze",
"channel",
"stat",
};
......@@ -37,7 +39,7 @@ static int cmd_ptrack(const char *args[])
spll_pshifter_freeze(0);
break;
case 1:
if (args[0]) {
if (args[1]) {
int ps = atoi(args[1]);
pp_printf("Freezing SPLL phase shifter at phase %d ps\n", ps);
spll_set_phase_shift(0, ps);
......@@ -52,6 +54,18 @@ static int cmd_ptrack(const char *args[])
pp_printf("Freezing SPLL VCO control");
spll_vco_freeze(1);
break;
case 3:
if (args[1]) {
int ch = atoi(args[1]);
pp_printf("enable ptracker %d\n", ch);
spll_enable_ptracker(ch, 1);
}
else
return -1;
break;
case 4:
ptracker_show_stats();
break;
}
return 0;
}
......
......@@ -546,6 +546,21 @@ void spll_get_num_channels(int *n_ref, int *n_out)
*n_out = spll_n_chan_out;
}
void ptracker_show_stats(void)
{
int ch;
for (ch = 0; ch < MAX_PTRACKERS; ch++) {
struct spll_ptracker_state *s =
(struct spll_ptracker_state *)&softpll.ptrackers[ch];
int32_t phase;
spll_read_ptracker(ch, &phase, NULL);
pp_printf("ptrack %d: en %d id %d ready %d phase %d (%d ps) avg %d\n",
ch, s->enabled, s->id, s->ready,
s->phase_val, (int)phase, s->n_avg);
}
}
void spll_show_stats(void)
{
struct softpll_state *s = (struct softpll_state *)&softpll;
......
......@@ -119,6 +119,7 @@ struct spll_aux_clock_status spll_get_aux_status(int channel );
int spll_get_delock_count(void);
void spll_show_stats(void);
void ptracker_show_stats(void);
/* Sets VCXO tuning DAC corresponding to output (out_channel) to a given value */
void spll_set_dac(int out_channel, int value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment