Commit 024b4964 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski Committed by Grzegorz Daniluk

wrs: added set_ptracker_average_samples() rt_ipc call

parent 9a4fabc1
...@@ -204,6 +204,16 @@ static int rts_enable_ptracker_func(const struct minipc_pd *pd, uint32_t *args, ...@@ -204,6 +204,16 @@ static int rts_enable_ptracker_func(const struct minipc_pd *pd, uint32_t *args,
return 0; return 0;
} }
static int rts_set_average_samples_func(const struct minipc_pd *pd, uint32_t *args, void *ret)
{
pstate.ipc_count++;
spll_set_ptracker_average_samples((int)args[0], (int)args[1]);
*(int *) ret = 0;
return 0;
}
static int rts_debug_command_func(const struct minipc_pd *pd, uint32_t *args, void *ret) static int rts_debug_command_func(const struct minipc_pd *pd, uint32_t *args, void *ret)
{ {
pstate.ipc_count++; pstate.ipc_count++;
...@@ -228,6 +238,7 @@ int rtipc_init(void) ...@@ -228,6 +238,7 @@ int rtipc_init(void)
rtipc_rts_adjust_phase_struct.f = rts_adjust_phase_func; rtipc_rts_adjust_phase_struct.f = rts_adjust_phase_func;
rtipc_rts_enable_ptracker_struct.f = rts_enable_ptracker_func; rtipc_rts_enable_ptracker_struct.f = rts_enable_ptracker_func;
rtipc_rts_debug_command_struct.f = rts_debug_command_func; rtipc_rts_debug_command_struct.f = rts_debug_command_func;
rtipc_rts_set_average_samples_struct.f = rts_set_average_samples_func;
minipc_export(server, &rtipc_rts_set_mode_struct); minipc_export(server, &rtipc_rts_set_mode_struct);
minipc_export(server, &rtipc_rts_get_state_struct); minipc_export(server, &rtipc_rts_get_state_struct);
...@@ -235,6 +246,7 @@ int rtipc_init(void) ...@@ -235,6 +246,7 @@ int rtipc_init(void)
minipc_export(server, &rtipc_rts_adjust_phase_struct); minipc_export(server, &rtipc_rts_adjust_phase_struct);
minipc_export(server, &rtipc_rts_enable_ptracker_struct); minipc_export(server, &rtipc_rts_enable_ptracker_struct);
minipc_export(server, &rtipc_rts_debug_command_struct); minipc_export(server, &rtipc_rts_debug_command_struct);
minipc_export(server, &rtipc_rts_set_average_samples_struct);
return 0; return 0;
......
...@@ -187,6 +187,16 @@ static struct minipc_pd rtipc_rts_debug_command_struct = { ...@@ -187,6 +187,16 @@ static struct minipc_pd rtipc_rts_debug_command_struct = {
}, },
}; };
static struct minipc_pd rtipc_rts_set_average_samples_struct = {
.name = "gggg",
.retval = MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int),
.args = {
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int ),
MINIPC_ARG_ENCODE(MINIPC_ATYPE_INT, int ),
MINIPC_ARG_END
},
};
#endif #endif
#endif #endif
...@@ -467,6 +467,21 @@ int spll_read_ptracker(int channel, int32_t *phase_ps, int *enabled) ...@@ -467,6 +467,21 @@ int spll_read_ptracker(int channel, int32_t *phase_ps, int *enabled)
return st->ready; return st->ready;
} }
void spll_set_ptracker_average_samples(int channel, int nsamples)
{
struct softpll_state *s = (struct softpll_state *) &softpll;
struct spll_ptracker_state *pt = &s->ptrackers[channel];
disable_irq();
pt->preserve_sign = 0;
pt->ready = 0;
pt->acc = 0;
pt->avg_count = 0;
pt->n_avg = nsamples;
enable_irq();
}
void spll_get_num_channels(int *n_ref, int *n_out) void spll_get_num_channels(int *n_ref, int *n_out)
{ {
if (n_ref) if (n_ref)
......
...@@ -108,6 +108,7 @@ int spll_get_dac(int out_channel); ...@@ -108,6 +108,7 @@ int spll_get_dac(int out_channel);
void check_vco_frequencies(void); void check_vco_frequencies(void);
int spll_measure_frequency(int osc); int spll_measure_frequency(int osc);
void spll_set_ptracker_average_samples(int channel, int nsamples);
/* /*
* Aux and main state: * Aux and main state:
......
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