git-svn-id: http://moon:8086/svn/software/trunk/libsrc/radio@1 b431acfa-c32f-4a4a-93f1-934dc6c82436
94 lines
2.5 KiB
C
Executable File
94 lines
2.5 KiB
C
Executable File
// --------------------------------------------------------------
|
|
#ifndef SYNCHRONIZATION_H
|
|
#define SYNCHRONIZATION_H
|
|
|
|
#include "radio_types.h"
|
|
#include "nco.h"
|
|
|
|
#define LEAD_LAG_SCALING ((radio_float_t)1024*1024)
|
|
// --------------------------------------------------------------
|
|
// Types
|
|
// --------------------------------------------------------------
|
|
typedef struct _clock_t
|
|
{
|
|
uint32_t reload;
|
|
int32_t count;
|
|
|
|
} clock_t;
|
|
|
|
typedef struct _lead_lag_filter_t
|
|
{
|
|
radio_float_t lag_state;
|
|
|
|
} lead_lag_filter_t;
|
|
|
|
typedef struct _lead_lag_coeff_t
|
|
{
|
|
radio_float_t lead;
|
|
radio_float_t lag;
|
|
|
|
} lead_lag_coeff_t;
|
|
|
|
typedef struct _str_t
|
|
{
|
|
cpx_t d[2];
|
|
|
|
} str_t;
|
|
|
|
typedef struct _pfd_t
|
|
{
|
|
uint32_t state_up;
|
|
uint32_t state_down;
|
|
} pfd_t;
|
|
|
|
typedef struct _timing_corrector_t
|
|
{
|
|
radio_float_t mu;
|
|
radio_float_t mu_filtered;
|
|
radio_float_t wrap_alpha;
|
|
radio_float_t wrap_beta;
|
|
uint32_t skip[2];
|
|
uint32_t stuff[2];
|
|
|
|
} timing_corrector_t;
|
|
|
|
// --------------------------------------------------------------
|
|
// Functions
|
|
// --------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void ClockInit(clock_t *pObj, uint32_t divide);
|
|
uint32_t ClockIsTick(clock_t *pObj, uint32_t do_advance);
|
|
void ClockAdvance(clock_t *pObj);
|
|
void ClockSetPhase(clock_t *pObj, int32_t phase);
|
|
|
|
void STRGardnerInit(str_t *pObj);
|
|
radio_float_t STRGardnerProcess(str_t *pObj, cpx_t x);
|
|
|
|
radio_float_t PhaseErrQPSK(cpx_t x);
|
|
radio_float_t PhaseErr(cpx_t x, radio_float_t pstep, radio_float_t poffset);
|
|
|
|
void PfdInit(pfd_t *pObj);
|
|
radio_float_t PfdProcess(pfd_t *pObj, radio_float_t x, radio_float_t k);
|
|
|
|
void LeadLagInit(lead_lag_filter_t *pObj, radio_float_t state);
|
|
void LeadLagSetCoeff(lead_lag_coeff_t *pCoeff, radio_float_t lead, radio_float_t lag);
|
|
radio_float_t LeadLagProcess(lead_lag_filter_t *pObj, lead_lag_coeff_t *pCoeff, radio_float_t x);
|
|
radio_float_t LeadLagGetState(lead_lag_filter_t *pObj);
|
|
void LeadLagSetState(lead_lag_filter_t *pObj, radio_float_t state);
|
|
|
|
void TimingCorrectorInit(timing_corrector_t *pObj, radio_float_t wrap_alpha);
|
|
radio_float_t TimingCorrectorProcess(timing_corrector_t *pObj, radio_float_t dMu);
|
|
radio_float_t TimingCorrectorGetMu(timing_corrector_t *pObj);
|
|
uint32_t TimingCorrectorIsSkip(timing_corrector_t *pObj);
|
|
uint32_t TimingCorrectorIsStuff(timing_corrector_t *pObj);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif // __cplusplus
|
|
|
|
// --------------------------------------------------------------
|
|
#endif // SYNCHRONIZATION_H
|