summaryrefslogtreecommitdiff
path: root/cesar/ce/rx/bitloading/test/src
diff options
context:
space:
mode:
authorJérémy Dufour2011-10-19 15:54:56 +0100
committerJalil Chemseddine2012-06-28 17:29:18 +0200
commita96affc664818d381abd57988311ca8fbdebd018 (patch)
treee16b8db1889bb849c8595834ec2fd0f26b256fe2 /cesar/ce/rx/bitloading/test/src
parentb57a45d6d46d88e641c97610c5ae7bc43852527f (diff)
cesar/ce/rx/bl: refactor PBER module, refs #3215
This commit includes: - refactoring of the PBER function to create a module to handle the PBER, - propose a new re-initialisation system - an impossible value means using the value from the first frame, - a valid value will be used as the initialization. - set default value of coefficient to last value defined by TNS team, - reset the PBER sliding mean after each CE restart, - isolate corresponding tests.
Diffstat (limited to 'cesar/ce/rx/bitloading/test/src')
-rw-r--r--cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c7
-rw-r--r--cesar/ce/rx/bitloading/test/src/scenario_events.c14
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_bl.c38
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_fsm.c35
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_pber.c73
5 files changed, 114 insertions, 53 deletions
diff --git a/cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c b/cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c
index f8e56dcf1e..bb08be9e60 100644
--- a/cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c
+++ b/cesar/ce/rx/bitloading/test/src/ce_rx_bl_stub.c
@@ -12,6 +12,7 @@
*/
#include "common/std.h"
#include "ce/rx/bitloading/inc/ber.h"
+#include "ce/rx/bitloading/pber.h"
u64
ce_rx_bl_ber_quantify (u32 ber_sum, u8 good_crc_pb_count, u16 pb_size)
@@ -30,3 +31,9 @@ ce_rx_bl_ber_pt_robo (uint carrier_nb)
{
return ce_rx_bl_ber_pt_bpt (0, carrier_nb, 0);
}
+
+u32
+ce_rx_bl_pber_compute (uint pb_total, uint pb_crc_false)
+{
+ return 0;
+}
diff --git a/cesar/ce/rx/bitloading/test/src/scenario_events.c b/cesar/ce/rx/bitloading/test/src/scenario_events.c
index 0d99c75707..4f27c00e2c 100644
--- a/cesar/ce/rx/bitloading/test/src/scenario_events.c
+++ b/cesar/ce/rx/bitloading/test/src/scenario_events.c
@@ -15,6 +15,7 @@
#include "ce/rx/bitloading/inc/nsr.h"
#include "ce/rx/bitloading/inc/ber.h"
#include "ce/rx/bitloading/inc/bitloading.h"
+#include "ce/rx/bitloading/pber.h"
#include "mac/common/tonemap.h"
#include "lib/scenario/scenario.h"
@@ -35,8 +36,17 @@ __event_empty_def (void, ce_rx_bl_start_bl, ce_rx_t *ce_rx, sta_t *sta,
tonemask_info_t *ts);
__event_empty_def (void, ce_rx_bl_ber_sliding_mean_update, ce_rx_bitloading_t *bl,
u64 ber);
-__event_empty_def (void, ce_rx_bl_pber_sliding_mean_update, ce_rx_bitloading_t *bl,
- uint pb_count, uint false_pb_count);
+__event_empty_def (void, ce_rx_bl_pber_update, ce_rx_bl_pber_t *ctx,
+ uint pber_q16);
+
+void
+ce_rx_bl_pber_reset (ce_rx_bl_pber_t *ctx)
+{
+ if (scenario.current != NULL)
+ {
+ scenario_event (ce_rx_bl_pber_reset);
+ }
+}
void
tonemaps_reset (tonemaps_t *tms, tonemap_release_list_t *tm_release_list)
diff --git a/cesar/ce/rx/bitloading/test/src/test_bl.c b/cesar/ce/rx/bitloading/test/src/test_bl.c
index 27593766bf..e09b6d5bcc 100644
--- a/cesar/ce/rx/bitloading/test/src/test_bl.c
+++ b/cesar/ce/rx/bitloading/test/src/test_bl.c
@@ -24,6 +24,7 @@
#include "ce/rx/bitloading/inc/common.h"
#include "ce/rx/bitloading/nsr.h"
#include "ce/rx/tonemask.h"
+#include "ce/rx/bitloading/pber.h"
#include "lib/rnd.h"
/* Test vectors. */
@@ -2005,40 +2006,6 @@ test_suite_ce_rx_bl_tm_update (test_t t)
}
int
-test_suite_ce_rx_bl_pber_sliding_mean_update_function (int pber_sliding_mean,
- uint pb_count,
- uint false_pb_count,
- uint supposed_new_pber)
-{
- /* Return 0 if test is ok and other value if the test fail.*/
- ce_rx_bitloading_t bt;
- bt.pber_sliding_mean = pber_sliding_mean;
- ce_rx_bl_pber_sliding_mean_update (&bt, pb_count, false_pb_count);
- if (supposed_new_pber == bt.pber_sliding_mean)
- return 0;
- else
- return 1;
-}
-
-static void
-test_suite_ce_rx_bl_pber_sliding_mean_update (test_t t)
-{
- test_begin (t, "test pber sliding mean.")
- {
- test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
- 100, 1, 1, 355));
- test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
- 10000, 1, 0, 9960));
- test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
- 0, 100, 10, 25));
- test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
- 65536, MAC_MAX_PB_PER_MPDU, MAC_MAX_PB_PER_MPDU, 65536));
- test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
- 65536, MAC_MAX_PB_PER_MPDU, 0, 65280));
- } test_end;
-}
-
-int
main (int argc, char **argv)
{
test_t t;
@@ -2102,9 +2069,6 @@ main (int argc, char **argv)
/* Test tone map update */
test_suite_ce_rx_bl_tm_update (t);
- /* Test PBER sliding mean. */
- test_suite_ce_rx_bl_pber_sliding_mean_update (t);
-
/* Memory check. */
test_case_begin (t, "General");
test_begin (t, "Memory")
diff --git a/cesar/ce/rx/bitloading/test/src/test_fsm.c b/cesar/ce/rx/bitloading/test/src/test_fsm.c
index 55f199b6fb..b0dacf1e85 100644
--- a/cesar/ce/rx/bitloading/test/src/test_fsm.c
+++ b/cesar/ce/rx/bitloading/test/src/test_fsm.c
@@ -31,7 +31,7 @@
#define CE_RX_BL_TEST_GENERIC_BER 0x4242
/* Value of the PB error rate sliding mean. */
-#define CE_RX_BL_PBERR_MEAN 655
+#define CE_RX_BL_PBERR_MEAN 0
/* Update one field for both variables. */
#define CE_RX_BL_TEST_STATS_UPDATE_ONE_TEST(arg) stats.arg;
@@ -50,7 +50,6 @@ 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;
-uint ce_rx_bl_pberr_mean_init_ = CE_RX_BL_PBERR_MEAN;
static uint const tmi_av = 24;
@@ -386,7 +385,7 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
}
scenario_test[pos++] = scenario_end;
scenario_run (t, scenario_test, &globals);
@@ -437,7 +436,7 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
}
scenario_test[pos++] = scenario_end;
scenario_run (t, scenario_test, &globals);
@@ -482,7 +481,7 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
}
scenario_test[pos++] = scenario_end;
scenario_run (t, scenario_test, &globals);
@@ -559,7 +558,7 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
}
scenario_entry_t sub_sc_ce_restart[] =
{
@@ -569,7 +568,9 @@ test_ce_rx_bl_fsm_base (test_t t)
.branch = ce_rx_bl_fsm_next_branch
(TRACKING, data, pb_err_rate_high)),
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update),
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update),
+ SCENARIO_EVENT (ce_rx_bl_pber_update),
+ /* Reset PBER sliding mean. */
+ SCENARIO_EVENT (ce_rx_bl_pber_reset),
/* Reset CE in RX. */
SCENARIO_EVENT (tonemaps_reset,
.tms = sta.rx_tonemaps),
@@ -631,7 +632,7 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
}
stats_pb += measure.total_pb_count * limit;
stats_frame += limit;
@@ -675,7 +676,10 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
+ /* Reset PBER sliding mean. */
+ scenario_test[pos++] = (scenario_entry_t)
+ SCENARIO_EVENT (ce_rx_bl_pber_reset);
/* Reset CE in RX. */
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (tonemaps_reset,
@@ -732,7 +736,7 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_END;
stats_pb += measure.total_pb_count;
@@ -778,7 +782,10 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
+ /* Reset PBER sliding mean. */
+ scenario_test[pos++] = (scenario_entry_t)
+ SCENARIO_EVENT (ce_rx_bl_pber_reset);
/* Reset CE in RX. */
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (tonemaps_reset,
@@ -832,7 +839,7 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_END;
stats_pb += measure.total_pb_count;
@@ -879,7 +886,7 @@ test_ce_rx_bl_fsm_base (test_t t)
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update);
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_END;
stats_pb += measure.total_pb_count;
@@ -929,7 +936,7 @@ test_ce_rx_bl_fsm_base (test_t t)
/* No SCENARIO_EVENT (ce_rx_bl_ber_sliding_mean_update) */
scenario_test[pos++] = (scenario_entry_t)
- SCENARIO_EVENT (ce_rx_bl_pber_sliding_mean_update);
+ SCENARIO_EVENT (ce_rx_bl_pber_update);
scenario_test[pos++] = (scenario_entry_t)
SCENARIO_END;
diff --git a/cesar/ce/rx/bitloading/test/src/test_pber.c b/cesar/ce/rx/bitloading/test/src/test_pber.c
new file mode 100644
index 0000000000..260914bcd8
--- /dev/null
+++ b/cesar/ce/rx/bitloading/test/src/test_pber.c
@@ -0,0 +1,73 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2011 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file ce/rx/bitloading/test/src/test_pber.c
+ */
+#include "common/std.h"
+
+#include "ce/rx/bitloading/pber.h"
+#include "mac/common/defs.h"
+#include "lib/test.h"
+
+
+int
+test_suite_ce_rx_bl_pber_sliding_mean_update_function (int pber_sliding_mean,
+ uint pb_count,
+ uint false_pb_count,
+ uint supposed_new_pber)
+{
+ /* Return 0 if test is ok and other value if the test fail.*/
+ ce_rx_bl_pber_t pber = { .mean_q16 = pber_sliding_mean};
+ ce_rx_bl_pber_update (&pber,
+ ce_rx_bl_pber_compute (pb_count, false_pb_count));
+ if (supposed_new_pber == pber.mean_q16)
+ return 0;
+ else
+ return 1;
+}
+
+static void
+test_ce_rx_bl_pber (test_t t)
+{
+ test_begin (t, "PBER reset")
+ {
+ ce_rx_bl_pber_t pber_ctx = { .mean_q16 = 0x42 };
+ ce_rx_bl_pber_conf.mean_init = 0x1;
+
+ ce_rx_bl_pber_reset (&pber_ctx);
+ test_fail_if (pber_ctx.mean_q16 != 0x1);
+ } test_end;
+
+ test_begin (t, "PBER sliding mean compute")
+ {
+ test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
+ 100, 1, 1, 355));
+ test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
+ 10000, 1, 0, 9960));
+ test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
+ 0, 100, 10, 25));
+ test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
+ 65536, MAC_MAX_PB_PER_MPDU, MAC_MAX_PB_PER_MPDU, 65536));
+ test_fail_if (test_suite_ce_rx_bl_pber_sliding_mean_update_function (
+ 65536, MAC_MAX_PB_PER_MPDU, 0, 65280));
+ } test_end;
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ test_init (t, argc, argv);
+
+ test_suite_begin (t, "CE:RX:BL:PBER");
+
+ test_ce_rx_bl_pber (t);
+
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}