Skip to content

File ratesync_private.h

File List > doppler > ratesync > ratesync_private.h

Go to the documentation of this file

#ifndef DP_RATESYNC_PRIVATE_H
#define DP_RATESYNC_PRIVATE_H

#include "doppler/ratesync/ratesync_core.h"

#ifdef __cplusplus
extern "C"
{
#endif

static inline double
dp_ratesync_loop_next_read (const ratesync_loop_t *l, double decim,
                            uint64_t term_in, double delay)
{
  return decim * ((double)term_in + dp_resamp_get_ctrl_lead (l->term))
         - delay;
}

int dp_ratesync_loop_seed_eye (ratesync_loop_t *l, double decim,
                               double t_next, double eye, double rate,
                               int set_rate);

int dp_ratesync_acquire_block (dp_timing_est_state_t *est, size_t symbols,
                               double quality, int *run, uint64_t *origin,
                               uint64_t index, float _Complex x,
                               double *eye);

/* The instant, on the input's timeline, that the terminal stage's next
   output reads. The inputs the stage has been handed and its accumulator's
   lead say where on its own timeline, the decimation ahead of it scales
   that to inputs, and the cascade's group delay is what an output lags the
   input by: dp_ratesync_loop_next_read() on RateSync's fields, the one
   statement every owner of the loop seeds by. The cascade must be bound
   (s->loop.term). */
static inline double
dp_ratesync_next_read (const dp_ratesync_state_t *s)
{
  return dp_ratesync_loop_next_read (&s->loop, s->decim, s->term_in,
                                     s->delay);
}

#ifdef __cplusplus
}
#endif

#endif /* DP_RATESYNC_PRIVATE_H */