#ifndef hal_phy_spoc_spoc_h #define hal_phy_spoc_spoc_h /* Cesar project {{{ * * Copyright (C) 2009 Spidcom * * <<>> * * }}} */ /** * \file hal/phy/spoc/spoc.h * \brief SPOC public interface. * \ingroup hal_phy */ #include "hal/phy/phy.h" /** M matrix coefficients number. */ #define PHY_SPOC_M_MATRIX_COEF_NB 41 /** CG vector coefficients numbers. */ #define PHY_SPOC_CG_VECTOR_COEF_NB 21 /** SPOC coefficients first part, fit in a 512 byte block. */ struct phy_spoc_coeff_t { /** Frequency error, Q30 format. */ s32 rho_q30; /** TX M matrix alpha coefficients. */ s32 tx_alpha[PHY_SPOC_M_MATRIX_COEF_NB]; /** TX M matrix beta coefficients. */ s32 tx_beta[PHY_SPOC_M_MATRIX_COEF_NB]; /** CG vector PR1 coefficients. */ s32 tx_prebegin[PHY_SPOC_CG_VECTOR_COEF_NB]; /** CG vector PR2 coefficients. */ s32 tx_preend[PHY_SPOC_CG_VECTOR_COEF_NB]; /** Pointer to second part. */ struct phy_spoc_coeff_part2_t *part2; }; typedef struct phy_spoc_coeff_t phy_spoc_coeff_t; /** SPOC coefficients second part, fit in a 512 byte block. */ struct phy_spoc_coeff_part2_t { /** CG vector FC 1.0 coefficients. */ s32 tx_fc10[PHY_SPOC_CG_VECTOR_COEF_NB]; /** CG vector FC AV coefficients. */ s32 tx_av[PHY_SPOC_CG_VECTOR_COEF_NB]; /** Rho inverse. */ s32 rx_inv_rho; /** RX M matrix alpha coefficients. */ s32 rx_alpha[PHY_SPOC_M_MATRIX_COEF_NB]; /** RX M matrix beta coefficients. */ s32 rx_beta[PHY_SPOC_M_MATRIX_COEF_NB]; }; typedef struct phy_spoc_coeff_part2_t phy_spoc_coeff_part2_t; BEGIN_DECLS /** * Compute CG vector for the given alpha factor. * \param rho_q30 frequency error, Q30 format * \param alpha the alpha factor * \param cg_vector CG vector result */ void phy_spoc_compute_cg_vector (s32 rho_q30, int alpha, s32 *cg_vector); /** * Compute SPOC M matrix approximation coefficients. * \param rho_q30 frequency error, Q30 format * \param reg_alpha alpha coefficients result * \param reg_beta beta coefficients result */ void phy_spoc_compute_m_matrix (s32 rho_q30, s32 *reg_alpha, s32 *reg_beta); /** * Compute all SPOC coefficients. * \param rho_q30 frequency error, Q30 format * \param coeff coefficients structure */ void phy_spoc_compute_all (s32 rho_q30, phy_spoc_coeff_t *coeff); /** * Initialise SPOC initial state. * \param ctx phy context * \param rho_q30 initial frequency error, Q30 format */ void phy_spoc_init (phy_t *ctx, s32 rho_q30); /** * Set SPOC coefficients for TX. * \param ctx phy context * \param coeff coefficients structure * * PRS and preamble should be regenerated before next TX (this is less * important for PRS). */ void phy_spoc_tx_set (phy_t *ctx, phy_spoc_coeff_t *coeff); /** * Set SPOC coefficients for RX. * \param ctx phy context * \param coeff coefficients structure */ void phy_spoc_rx_set (phy_t *ctx, phy_spoc_coeff_t *coeff); END_DECLS #endif /* hal_phy_spoc_spoc_h */