git-svn-id: http://moon:8086/svn/software/trunk/libsrc/radio@1 b431acfa-c32f-4a4a-93f1-934dc6c82436
97 lines
2.7 KiB
C
Executable File
97 lines
2.7 KiB
C
Executable File
// --------------------------------------------------------------
|
|
#ifndef EQUALIZER_H
|
|
#define EQUALIZER_H
|
|
|
|
#include "radio_types.h"
|
|
#include "real.h"
|
|
#include "cpx.h"
|
|
|
|
// --------------------------------------------------------------
|
|
#define CEF_MODE_NOP 0
|
|
#define CEF_MODE_CMA 1
|
|
#define CEF_MODE_DD 2
|
|
#define CEF_MODE_EQ_UPD 3
|
|
|
|
// --------------------------------------------------------------
|
|
// Types
|
|
// --------------------------------------------------------------
|
|
typedef struct _eq_cpx_t
|
|
{
|
|
uint32_t N;
|
|
cpx_t *pX, *pW;
|
|
cpx_t *pW_conj;
|
|
|
|
} eq_cpx_t;
|
|
|
|
typedef struct _cma_t
|
|
{
|
|
uint32_t N, M;
|
|
eq_cpx_t eq;
|
|
radio_float_t Px, Px_last;
|
|
|
|
} cma_t;
|
|
|
|
typedef struct _dfe_cpx_t
|
|
{
|
|
uint32_t N, N_ff, N_fb;
|
|
eq_cpx_t eq;
|
|
|
|
} dfe_cpx_t;
|
|
|
|
typedef struct _rls_t
|
|
{
|
|
uint32_t N, M;
|
|
cpx_t *pX, *pW, *pZ, *pR, *pT;
|
|
radio_float_t *R, *T, *T2, *z, *w, *x;
|
|
|
|
} rls_t;
|
|
|
|
// --------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
// --------------------------------------------------------------
|
|
// Functions
|
|
// --------------------------------------------------------------
|
|
// Helpers
|
|
void CoeffComplexUnitAt(cpx_t *pW, uint32_t N, uint32_t dly);
|
|
void CoeffComplexConv(cpx_t *pSrc, cpx_t *pDst, uint32_t N, uint32_t dly);
|
|
|
|
// General Equalizer
|
|
void EQComplexInit(eq_cpx_t *pObj, uint32_t N);
|
|
void EQComplexFree(eq_cpx_t *pObj);
|
|
cpx_t EQComplexProcess(eq_cpx_t *pObj, cpx_t x);
|
|
|
|
// CMA Blind Adaption (uses EQComplex and LMSUpdate)
|
|
void CMAInit(cma_t *pObj, uint32_t ntaps);
|
|
void CMAFree(cma_t *pObj);
|
|
cpx_t CMAProcess(cma_t *pObj, cpx_t x);
|
|
void CMATrainGodard(cma_t *pObj, cpx_t sym_s_eq, radio_float_t mag_h, radio_float_t R2, radio_float_t mu);
|
|
|
|
// MMA
|
|
void MMATrain(cma_t *pObj, cpx_t sym_s_eq, cpx_t R, radio_float_t mu);
|
|
void SMMATrain(cma_t *pObj, cpx_t sym_s_eq, radio_float_t mag_h, cpx_t R, radio_float_t mu);
|
|
|
|
// DFE Decision Directed Adaption (uses EQComplex and LMSUpdate)
|
|
void DFEComplexInit(dfe_cpx_t *pObj, uint32_t K);
|
|
void DFEComplexFree(dfe_cpx_t *pObj);
|
|
cpx_t DFEComplexProcess(dfe_cpx_t *pObj, cpx_t xs, cpx_t xh);
|
|
void DFEAdaptLMS(dfe_cpx_t *pObj, cpx_t e, radio_float_t mu);
|
|
|
|
// LMS Adaption
|
|
void LMSUpdateWeigths(eq_cpx_t *pObj, cpx_t e, radio_float_t mu);
|
|
|
|
// RLS Adaption
|
|
void RLSInit(rls_t *pObj, uint32_t N, uint32_t M);
|
|
void RLSFree(rls_t *pObj);
|
|
cpx_t RLSProcess(rls_t *pObj, radio_float_t i, radio_float_t q);
|
|
radio_float_t RLSUpdate(rls_t *pObj, radio_float_t rho, radio_float_t mu, radio_float_t y, radio_float_t d);
|
|
|
|
// --------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
// --------------------------------------------------------------
|
|
#endif // EQUALIZER_H
|