#ifndef M_2PI
#define M_2PI 6.28318530717958647692
#endif

/* phase extraction methods: 0=sine, 1=atan (BVR uses sine) */
#define PHASE_EXTRACTION_METHOD 0
/* Computational delay in DPLL (see n_c in Stephans & Thomas paper) */
/* (BVR uses n_c=1) */
#define COMPUTATIONAL_DELAY 1

typedef struct {
   int firsttime,                /* flag needed to initialize loop */
       order;                    /* loop order */
   double update_period,         /* loop update period */
          nominal_frequency,     /* NCO rest frequency */
          frequency,             /* offset from nominal frequency */
          phase,                 /* phase estimate for current update */
          bandwidth,
          k1,                    /* allow up to fourth order loops */
          k2,
          k3,
          k4,
          sum2,                  /* summations needed in update equations */
          sum3,
          sum4,
          error[COMPUTATIONAL_DELAY+1];  /* most recent loop filter inputs */
} dpllstruct;