summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authorJalil Chemseddine2012-10-11 16:56:01 +0200
committerJalil Chemseddine2013-01-11 11:22:32 +0100
commitd4fdaf44e909e612f284730f796c21f848a8db12 (patch)
treeea1b05b2d5b213626897d823231a928712c08a4a /cesar
parent090a54f477186a47a537d0faa96429fc0cbf8945 (diff)
cesar/ce/rx/bl: create structure for ber configuration, refs #3251
Diffstat (limited to 'cesar')
-rw-r--r--cesar/ce/rx/bitloading/inc/ber.h34
-rw-r--r--cesar/ce/rx/bitloading/src/ber.c37
-rw-r--r--cesar/ce/rx/bitloading/src/bitloading.c2
-rw-r--r--cesar/ce/rx/bitloading/src/transition.c2
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_bl.c2
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_fsm.c9
-rw-r--r--cesar/ce/rx/src/rx.c6
7 files changed, 71 insertions, 21 deletions
diff --git a/cesar/ce/rx/bitloading/inc/ber.h b/cesar/ce/rx/bitloading/inc/ber.h
index 9d82ff55e6..9f6d477e3a 100644
--- a/cesar/ce/rx/bitloading/inc/ber.h
+++ b/cesar/ce/rx/bitloading/inc/ber.h
@@ -53,6 +53,40 @@ struct ce_rx_bl_ber_poly_coef_t
typedef struct ce_rx_bl_ber_poly_coef_t ce_rx_bl_ber_poly_coef_t;
/**
+ * Configuration of the BER module.
+ */
+typedef struct ce_rx_bl_ber_conf_t
+{
+ /**
+ * Limit of the BER.
+ */
+ uint lower_bound;
+ /**
+ * Sliding mean fast factor.
+ */
+ u16 sliding_mean_fast_factor;
+ /**
+ * Sliding mean slow factor.
+ */
+ u16 sliding_mean_slow_factor;
+
+} ce_rx_bl_ber_conf_t;
+
+/**
+ * The configuration of the BER module.
+ */
+extern ce_rx_bl_ber_conf_t ce_rx_bl_ber_conf;
+
+
+extern inline void
+ce_rx_bl_ber_conf_init (void)
+{
+ ce_rx_bl_ber_conf.lower_bound = CE_RX_BL_BER_LOWER_BOUND;
+ ce_rx_bl_ber_conf.sliding_mean_fast_factor = CE_RX_BL_BER_SLIDING_MEAN_FAST_FACTOR;
+ ce_rx_bl_ber_conf.sliding_mean_slow_factor = CE_RX_BL_BER_SLIDING_MEAN_SLOW_FACTOR;
+}
+
+/**
* Polynomials coefficients for the bit loading.
* They work for NSR based on sound and data.
*/
diff --git a/cesar/ce/rx/bitloading/src/ber.c b/cesar/ce/rx/bitloading/src/ber.c
index bdb74ee0cd..2397aa1d68 100644
--- a/cesar/ce/rx/bitloading/src/ber.c
+++ b/cesar/ce/rx/bitloading/src/ber.c
@@ -20,6 +20,11 @@
#include "ce/rx/ce_rx_param.h"
/**
+ * The configuration of the BER module.
+ */
+ce_rx_bl_ber_conf_t ce_rx_bl_ber_conf;
+
+/**
* Default value of margin to apply to BER target.
* This value is apparently quantified on 53 bits.
*
@@ -59,12 +64,6 @@ static const u8 ce_rx_bl_ber_consign_degrees_eoc[PHY_FEC_RATE_NB] =
CE_RX_BL_BER_CONSIGN_DEGREES_EOC
};
-static const u16
-ce_rx_bl_ber_sliding_mean_factor[CE_RX_BL_BER_SLIDING_MEAN_NB] = {
- CE_RX_BL_BER_SLIDING_MEAN_FAST_FACTOR,
- CE_RX_BL_BER_SLIDING_MEAN_SLOW_FACTOR
-};
-
const u64 ce_rx_bl_initial_bpt[PHY_FEC_RATE_NB] = {
10 * CE_RX_BL_BPT_QUANT_FACTOR,
10 * CE_RX_BL_BPT_QUANT_FACTOR
@@ -206,6 +205,7 @@ ce_rx_bl_ber_sliding_mean_update (ce_rx_bitloading_t *bl, u64 ber)
dbg_assert (bl);
uint i;
+
/* First value? */
if (bl->ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST] == -1)
{
@@ -217,17 +217,22 @@ ce_rx_bl_ber_sliding_mean_update (ce_rx_bitloading_t *bl, u64 ber)
}
else
{
- for (i = 0; i < CE_RX_BL_BER_SLIDING_MEAN_NB; i++)
- {
- /* Update sliding means. */
- bl->ber_sliding_mean[i]
- = ((u64) ce_rx_bl_ber_sliding_mean_factor[i]
- * bl->ber_sliding_mean[i]
+ /* Update fast sliding mean. */
+ bl->ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
+ = ((u64) ce_rx_bl_ber_conf.sliding_mean_fast_factor
+ * bl->ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_FAST]
+ (CE_RX_BL_BER_SLIDING_MEAN_FACTOR_DIV
- - ce_rx_bl_ber_sliding_mean_factor[i])
- * ber)
- / CE_RX_BL_BER_SLIDING_MEAN_FACTOR_DIV;
- }
+ - ce_rx_bl_ber_conf.sliding_mean_fast_factor) * ber)
+ / CE_RX_BL_BER_SLIDING_MEAN_FACTOR_DIV;
+
+ /* Update slow sliding mean. */
+ bl->ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW]
+ = ((u64) ce_rx_bl_ber_conf.sliding_mean_slow_factor
+ * bl->ber_sliding_mean[CE_RX_BL_BER_SLIDING_MEAN_SLOW]
+ + (CE_RX_BL_BER_SLIDING_MEAN_FACTOR_DIV
+ - ce_rx_bl_ber_conf.sliding_mean_slow_factor) * ber)
+ / CE_RX_BL_BER_SLIDING_MEAN_FACTOR_DIV;
+
}
}
diff --git a/cesar/ce/rx/bitloading/src/bitloading.c b/cesar/ce/rx/bitloading/src/bitloading.c
index 11d14fb614..5853d373d5 100644
--- a/cesar/ce/rx/bitloading/src/bitloading.c
+++ b/cesar/ce/rx/bitloading/src/bitloading.c
@@ -31,7 +31,7 @@ uint ce_rx_bl_pb_false_factor_ = CE_RX_BL_PB_FALSE_FACTOR;
uint ce_rx_bl_pb_total_factor_ = CE_RX_BL_PB_TOTAL_FACTOR;
uint ce_rx_bl_min_pb_per_frame_ = CE_RX_BL_MIN_PB_PER_FRAME;
uint ce_rx_bl_min_frame_with_high_pb_err_rate_ = CE_RX_BL_MIN_FRAME_WITH_HIGH_PB_ERR_RATE;
-uint ce_rx_bl_ber_lower_bound_ = CE_RX_BL_BER_LOWER_BOUND;
+
/**
* Number of LSB to remove of the BER to compute the BER weighted sum.
diff --git a/cesar/ce/rx/bitloading/src/transition.c b/cesar/ce/rx/bitloading/src/transition.c
index 8e2e01d31f..febbb0d4a8 100644
--- a/cesar/ce/rx/bitloading/src/transition.c
+++ b/cesar/ce/rx/bitloading/src/transition.c
@@ -427,7 +427,7 @@ ce_rx_bl_fsm__TRACKING__data (ce_rx_t *ce_rx,
}
u64 lower_bound = ber_target
- - (ber_target * ce_rx_bl_ber_lower_bound_
+ - (ber_target * ce_rx_bl_ber_conf.lower_bound
/ CE_RX_BL_BER_LOWER_BOUND_UNIT);
/* Get BER sliding means. */
s64 *bsm = bl->ber_sliding_mean;
diff --git a/cesar/ce/rx/bitloading/test/src/test_bl.c b/cesar/ce/rx/bitloading/test/src/test_bl.c
index a27e9bf366..3c876eff58 100644
--- a/cesar/ce/rx/bitloading/test/src/test_bl.c
+++ b/cesar/ce/rx/bitloading/test/src/test_bl.c
@@ -1276,6 +1276,8 @@ main (int argc, char **argv)
test_suite_begin (t, "CE:RX:BL");
+ ce_rx_bl_ber_conf_init ();
+
/* BER target margin. */
test_suite_ce_rx_bl_ber_target_margin (t);
diff --git a/cesar/ce/rx/bitloading/test/src/test_fsm.c b/cesar/ce/rx/bitloading/test/src/test_fsm.c
index 6d69104d5b..f87d71e66c 100644
--- a/cesar/ce/rx/bitloading/test/src/test_fsm.c
+++ b/cesar/ce/rx/bitloading/test/src/test_fsm.c
@@ -14,6 +14,7 @@
#include "ce/rx/inc/rx.h"
#include "ce/rx/bitloading/inc/ber_margin_update.h"
+#include "ce/rx/bitloading/inc/ber.h"
#include "ce/rx/bitloading/fsm/event.h"
#include "ce/rx/inc/measure.h"
#include "ce/common/mod.h"
@@ -59,7 +60,11 @@ uint ce_rx_bl_pb_false_factor_;
uint ce_rx_bl_pb_total_factor_;
uint ce_rx_bl_min_pb_per_frame_;
uint ce_rx_bl_min_frame_with_high_pb_err_rate_;
-uint ce_rx_bl_ber_lower_bound_ = 38;
+/**
+ * The configuration of the BER module.
+ */
+ce_rx_bl_ber_conf_t ce_rx_bl_ber_conf;
+
extern uint ce_rx_bl_min_time_between_resend_tm_ms;
static uint const tmi_av = 24;
@@ -249,7 +254,7 @@ test_ce_rx_bl_fsm_base (test_t t)
.ce = &ce,
};
ce.tck_per_rtc = 1;
-
+ ce_rx_bl_ber_conf.lower_bound = 38;
/* Initialize BMU configuration.*/
ce_rx_bl_bmu_conf_init (&config.tonemask_info);
/* Force BMU configuration with TNS config (see #3351). */
diff --git a/cesar/ce/rx/src/rx.c b/cesar/ce/rx/src/rx.c
index e4d33eca28..2b8c527ff1 100644
--- a/cesar/ce/rx/src/rx.c
+++ b/cesar/ce/rx/src/rx.c
@@ -75,6 +75,8 @@ ce_rx_init (mac_store_t *mac_store, sar_t *sar, pbproc_t *pbproc,
/* Initialize extra tonemask to mask faulty carriers
* during tonemap generation. */
ce_rx_init_tonemask (&ce_rx);
+ /* Initialize BER configuration.*/
+ ce_rx_bl_ber_conf_init();
/* Initialize BMU configuration.*/
ce_rx_bl_bmu_conf_init (&ce_rx.tonemask);
@@ -108,8 +110,10 @@ ce_rx_init (mac_store_t *mac_store, sar_t *sar, pbproc_t *pbproc,
&ce_rx_bl_min_frame_with_high_pb_err_rate_,
LIB_STATS_ACCESS_READ_WRITE,
LIB_STATS_DEBUG);
+ /* Get BER config*/
+ ce_rx_bl_ber_conf_t *ber_conf = &ce_rx_bl_ber_conf;
lib_stats_set_stat_value_notype ("CE_RX_BL_BER_LOWER_BOUND",
- &ce_rx_bl_ber_lower_bound_,
+ &ber_conf->lower_bound,
LIB_STATS_ACCESS_READ_WRITE,
LIB_STATS_DEBUG);
lib_stats_set_stat_value_notype ("CE_RX_BL_MIN_TIME_BETWEEN_CE_RESTART_PBER_MS",