summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2013-06-14 11:22:31 +0200
committerNicolas Schodet2013-06-14 11:22:31 +0200
commit88ab4236c814ddd5389e82ca482ea1e6c1fcc41e (patch)
tree1583407c3a3ca71dd2349a994c20f1390fefdf62
parentb7c4b8292ee2996601c542a509564c74a3bf9ff1 (diff)
parentfa03386281a1a969ebf421348e57502e88c0d8b8 (diff)
Merge branch 'corner-spoc-mask' into eoc-corner-spoc-mask
-rw-r--r--cesar/hal/phy/inc/phy_params.txt2
-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
-rw-r--r--cesar/hal/phy/src/phy_params.pl2
5 files changed, 72 insertions, 14 deletions
diff --git a/cesar/hal/phy/inc/phy_params.txt b/cesar/hal/phy/inc/phy_params.txt
index 198f31eceb..125d897b11 100644
--- a/cesar/hal/phy/inc/phy_params.txt
+++ b/cesar/hal/phy/inc/phy_params.txt
@@ -75,11 +75,13 @@ tx_spoc_filter_shift = (d_mul, 0), (m_mul, 0), (m_add1, 0),
(mappowse_add3, 1), (mappowse_add4, 0),
(mappowse_add5, 0)
tx_spoc_offset_blk_exp = (spoc_tx, 1), (mappowse_tx, 1)
+tx_spoc_matrix_mask = 0x1fff0001fffull
rx_spoc_filter_shift = (d_mul, 0), (m_mul, 0), (m_add1, 0),
(m_add2, 0), (m_add3, 0), (m_add4, 0),
(m_add5, 0), (m_add6, 0)
rx_spoc_offset_blk_exp = (spoc_tx, 0)
+rx_spoc_matrix_mask = 0x1f80000003full
wiener_real = { 0, 0, 0, 0, 0, 41989, 45323, 48035, 50037, 51265, 51679, 51265, 50037, 48035, 45323, 41989, 0, 0, 0, 0, 0 }
wiener_imag = { 0, 0, 0, 0, 0, -7484, -6689, -5441, -3835, -1981, 0, 1981, 3835, 5441, 6689, 7484, 0, 0, 0, 0, 0}
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..407881a359 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. */
@@ -167,6 +171,8 @@ static phy_tunable_t phy_tunable =
PHY_PARAM_MAFADESE_COEF_FILTER_BAND1,
},
0,
+ PHY_PARAM_TX_SPOC_MATRIX_MASK,
+ PHY_PARAM_RX_SPOC_MATRIX_MASK,
PHY_PARAM_CHANNEL_ESTIM_COEF__COEF_RES_DELTA_INTERNAL,
PHY_PARAM_CHANNEL_ESTIM_COEF__COEF_RES_DELTA_EXTERNAL,
0,
@@ -561,6 +567,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 +896,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 (
diff --git a/cesar/hal/phy/src/phy_params.pl b/cesar/hal/phy/src/phy_params.pl
index 3231e07ac0..f1fc57f2a1 100644
--- a/cesar/hal/phy/src/phy_params.pl
+++ b/cesar/hal/phy/src/phy_params.pl
@@ -13,7 +13,7 @@ sub process
{
my ($name, $value) = @_;
$name = uc $name;
- my $n = '[-+]?[0-9xXa-fA-F]+';
+ my $n = '[-+]?[0-9xXa-fA-F]+u?(?:ll)?';
my $p = '\(\s*[a-z][a-z0-9_]+\s*,\s*' . $n . '\)';
if ($value =~ /^[a-z]/)
{