summaryrefslogtreecommitdiff
path: root/cesar/hal
diff options
context:
space:
mode:
authorNicolas Schodet2013-05-29 15:12:34 +0200
committerNicolas Schodet2013-06-14 11:22:15 +0200
commit70a03ba7b684038f8c0eeae2b62b338c369b92d7 (patch)
treea9f91adacb1587d859291cd4209353b83cab37b6 /cesar/hal
parent59c5a9475c1d3b76f50852fa7afe394a4c173a8f (diff)
cesar/hal/phy: add spoc matrix mask, refs #4041
Diffstat (limited to 'cesar/hal')
-rw-r--r--cesar/hal/phy/spoc/spoc.h5
-rw-r--r--cesar/hal/phy/spoc/src/spoc_regs.c60
-rw-r--r--cesar/hal/phy/src/phy.c17
3 files changed, 68 insertions, 14 deletions
diff --git a/cesar/hal/phy/spoc/spoc.h b/cesar/hal/phy/spoc/spoc.h
index 2247b6c697..6ea1c7de9d 100644
--- a/cesar/hal/phy/spoc/spoc.h
+++ b/cesar/hal/phy/spoc/spoc.h
@@ -88,9 +88,12 @@ phy_spoc_compute_all (s32 rho_q30, phy_spoc_coeff_t *coeff);
* \param rho_q30 initial frequency error, Q30 format
* \param tonemask tonemask data
* \param carrier_nb number of active carriers in the given tone mask
+ * \param tx_matrix_mask set masked coefficient to zero for TX M matrix
+ * \param rx_matrix_mask set masked coefficient to zero for RX M matrix
*/
void
-phy_spoc_init (phy_t *ctx, s32 rho_q30, const u32 *tonemask, uint carrier_nb);
+phy_spoc_init (phy_t *ctx, s32 rho_q30, const u32 *tonemask, uint carrier_nb,
+ u64 tx_matrix_mask, u64 rx_matrix_mask);
/**
* Set SPOC coefficients for TX.
diff --git a/cesar/hal/phy/spoc/src/spoc_regs.c b/cesar/hal/phy/spoc/src/spoc_regs.c
index 6b79046823..3ddf7b4e75 100644
--- a/cesar/hal/phy/spoc/src/spoc_regs.c
+++ b/cesar/hal/phy/spoc/src/spoc_regs.c
@@ -21,6 +21,26 @@
#include "hal_phy_params.h"
+/** Matrix coefficient masks. */
+static u64 phy_spoc_tx_matrix_mask, phy_spoc_rx_matrix_mask;
+
+/**
+ * Return masked value for given coefficient.
+ * \param coef coefficient array
+ * \param index coefficient index
+ * \param mask full mask
+ * \return coefficient or zero freqerr value
+ */
+static inline s32
+phy_spoc_coef_mask (const s32 *coef, int index, u64 mask)
+{
+ if (mask & (1ull << index))
+ return index == PHY_SPOC_M_MATRIX_MIDDLE
+ ? FIXED (1, PHY_SPOC_BETA_Q) : 0;
+ else
+ return coef[index];
+}
+
/**
* Set SPOC coefficients for Wiener.
* \param ctx phy context
@@ -31,8 +51,12 @@ static void
phy_spoc_wiener_set (phy_t *ctx, const u32 *tonemask, uint carrier_nb);
void
-phy_spoc_init (phy_t *ctx, s32 rho_q30, const u32 *tonemask, uint carrier_nb)
+phy_spoc_init (phy_t *ctx, s32 rho_q30, const u32 *tonemask, uint carrier_nb,
+ u64 tx_matrix_mask, u64 rx_matrix_mask)
{
+ /* Keep masks. */
+ phy_spoc_tx_matrix_mask = tx_matrix_mask;
+ phy_spoc_rx_matrix_mask = rx_matrix_mask;
/* Compute coefficients for 0 frequency error. */
phy_spoc_coeff_t coeff;
phy_spoc_coeff_part2_t coeff_part2;
@@ -61,16 +85,21 @@ phy_spoc_tx_set (phy_t *ctx, phy_spoc_coeff_t *coeff)
PHY_DSPSS_SPOC_RHO_WIENER_USED_CARRIER =
fixed_round (coeff->rho_q30, 30 - PHY_SPOC_RHO_Q);
PHY_DSPSS_SPOC_M_CENTRAL_WIENER_FIRST_CARRIER =
- coeff->tx_alpha[PHY_SPOC_M_MATRIX_MIDDLE];
+ phy_spoc_coef_mask (coeff->tx_alpha, PHY_SPOC_M_MATRIX_MIDDLE,
+ phy_spoc_tx_matrix_mask);
for (i = 0; i < PHY_SPOC_M_MATRIX_MIDDLE; i++)
{
- PHY_DSPSS_SPOC_M_ALPHA_n[i] = coeff->tx_alpha[i];
- PHY_DSPSS_SPOC_M_BETA_n[i] = coeff->tx_beta[i];
+ PHY_DSPSS_SPOC_M_ALPHA_n[i] =
+ phy_spoc_coef_mask (coeff->tx_alpha, i, phy_spoc_tx_matrix_mask);
+ PHY_DSPSS_SPOC_M_BETA_n[i] =
+ phy_spoc_coef_mask (coeff->tx_beta, i, phy_spoc_tx_matrix_mask);
}
for (i = PHY_SPOC_M_MATRIX_MIDDLE + 1; i < PHY_SPOC_M_MATRIX_COEF_NB; i++)
{
- PHY_DSPSS_SPOC_M_ALPHA_n[i - 1] = coeff->tx_alpha[i];
- PHY_DSPSS_SPOC_M_BETA_n[i - 1] = coeff->tx_beta[i];
+ PHY_DSPSS_SPOC_M_ALPHA_n[i - 1] =
+ phy_spoc_coef_mask (coeff->tx_alpha, i, phy_spoc_tx_matrix_mask);
+ PHY_DSPSS_SPOC_M_BETA_n[i - 1] =
+ phy_spoc_coef_mask (coeff->tx_beta, i, phy_spoc_tx_matrix_mask);
}
for (i = 0; i < PHY_SPOC_CG_VECTOR_COEF_NB; i++)
{
@@ -103,16 +132,25 @@ phy_spoc_rx_set (phy_t *ctx, phy_spoc_coeff_t *coeff)
PHY_DSPSS_SPOC_CP_PREBEGIN_0_WIENER_REAL_0_RX_SCO =
coeff->part2->rx_inv_rho;
PHY_DSPSS_SPOC_M_CENTRAL_WIENER_FIRST_CARRIER =
- coeff->part2->rx_alpha[PHY_SPOC_M_MATRIX_MIDDLE];
+ phy_spoc_coef_mask (coeff->part2->rx_alpha, PHY_SPOC_M_MATRIX_MIDDLE,
+ phy_spoc_rx_matrix_mask);
for (i = 0; i < PHY_SPOC_M_MATRIX_MIDDLE; i++)
{
- PHY_DSPSS_SPOC_M_ALPHA_n[i] = coeff->part2->rx_alpha[i];
- PHY_DSPSS_SPOC_M_BETA_n[i] = coeff->part2->rx_beta[i];
+ PHY_DSPSS_SPOC_M_ALPHA_n[i] =
+ phy_spoc_coef_mask (coeff->part2->rx_alpha, i,
+ phy_spoc_rx_matrix_mask);
+ PHY_DSPSS_SPOC_M_BETA_n[i] =
+ phy_spoc_coef_mask (coeff->part2->rx_beta, i,
+ phy_spoc_rx_matrix_mask);
}
for (i = PHY_SPOC_M_MATRIX_MIDDLE + 1; i < PHY_SPOC_M_MATRIX_COEF_NB; i++)
{
- PHY_DSPSS_SPOC_M_ALPHA_n[i - 1] = coeff->part2->rx_alpha[i];
- PHY_DSPSS_SPOC_M_BETA_n[i - 1] = coeff->part2->rx_beta[i];
+ PHY_DSPSS_SPOC_M_ALPHA_n[i - 1] =
+ phy_spoc_coef_mask (coeff->part2->rx_alpha, i,
+ phy_spoc_rx_matrix_mask);
+ PHY_DSPSS_SPOC_M_BETA_n[i - 1] =
+ phy_spoc_coef_mask (coeff->part2->rx_beta, i,
+ phy_spoc_rx_matrix_mask);
}
PHY_DSPSS_SPOC_FILTER_SHIFT =
BF_FILL (PHY_DSPSS_SPOC_FILTER_SHIFT, PHY_PARAM_RX_SPOC_FILTER_SHIFT);
diff --git a/cesar/hal/phy/src/phy.c b/cesar/hal/phy/src/phy.c
index 9c81a9f002..1b4634b71f 100644
--- a/cesar/hal/phy/src/phy.c
+++ b/cesar/hal/phy/src/phy.c
@@ -127,6 +127,10 @@ struct phy_tunable_t
phy_mafadese_filter_t mafadese_filter;
/** SPOC initial setting. */
s32 spoc_rho_initial_q30;
+ /** SPOC TX coefficients mask. */
+ u64 spoc_tx_matrix_mask;
+ /** SPOC RX coefficients mask. */
+ u64 spoc_rx_matrix_mask;
/** Internal delta accumulation coefficient. */
uint delta_res_coef_internal;
/** External delta accumulation coefficient. */
@@ -166,7 +170,7 @@ static phy_tunable_t phy_tunable =
PHY_PARAM_MAFADESE_COEF_FILTER_BAND0,
PHY_PARAM_MAFADESE_COEF_FILTER_BAND1,
},
- 0,
+ 0, 0, 0,
PHY_PARAM_CHANNEL_ESTIM_COEF__COEF_RES_DELTA_INTERNAL,
PHY_PARAM_CHANNEL_ESTIM_COEF__COEF_RES_DELTA_EXTERNAL,
0,
@@ -561,6 +565,14 @@ phy_init_tunable_param (phy_t *ctx)
&phy_tunable.spoc_rho_initial_q30,
LIB_STATS_ACCESS_WRITE_ONLY,
LIB_STATS_DEBUG);
+ lib_stats_set_stat_value_notype ("SPOC_TX_MATRIX_MASK",
+ &phy_tunable.spoc_tx_matrix_mask,
+ LIB_STATS_ACCESS_WRITE_ONLY,
+ LIB_STATS_DEBUG);
+ lib_stats_set_stat_value_notype ("SPOC_RX_MATRIX_MASK",
+ &phy_tunable.spoc_rx_matrix_mask,
+ LIB_STATS_ACCESS_WRITE_ONLY,
+ LIB_STATS_DEBUG);
lib_stats_set_stat_value_notype ("DELTA_RES_COEF_INTERNAL",
&phy_tunable.delta_res_coef_internal,
LIB_STATS_ACCESS_WRITE_ONLY,
@@ -882,7 +894,8 @@ phy_set_tunable_param (phy_t *ctx, const u32 *tonemask, uint carrier_nb)
PHY_DSPSS_MAFADESE_COEF_FILTER_BAND_1_n[i] =
phy_tunable.mafadese_filter.coef_filter_band1[i];
phy_spoc_init (ctx, phy_tunable.spoc_rho_initial_q30, tonemask,
- carrier_nb);
+ carrier_nb, phy_tunable.spoc_tx_matrix_mask,
+ phy_tunable.spoc_rx_matrix_mask);
PHY_DSPSS_CHANNEL_ESTIM_COEF =
PHY_PARAMS (PHY_DSPSS, CHANNEL_ESTIM_COEF, COEF_PREAMBLE)
| BF_FILL (