summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/ce/rx/bitloading/test/src/test_fsm.c4
-rw-r--r--cesar/ce/rx/inc/measure.h16
-rw-r--r--cesar/ce/rx/inc/rx.h4
-rw-r--r--cesar/ce/rx/measure.h15
-rw-r--r--cesar/ce/rx/src/measure.c149
-rw-r--r--cesar/ce/rx/src/rx.c2
-rw-r--r--cesar/ce/rx/src/trace.c2
-rw-r--r--cesar/ce/rx/stub/src/rx.c22
-rw-r--r--cesar/ce/rx/test/src/test_rx.c95
-rw-r--r--cesar/mac/sar/sar.h39
-rw-r--r--cesar/mac/sar/src/sar.c53
-rw-r--r--cesar/mac/sar/test/functional/src/sar_rx.c2
-rw-r--r--cesar/mac/sar/test/functional/src/sar_tx.c2
-rw-r--r--cesar/mac/sar/test/functional/src/test_functions.c21
-rw-r--r--cesar/mac/sar/test/functional/test_functions.h9
-rw-r--r--cesar/mac/sar/test/unit_test/ecos/override/ce/rx/rx.h84
-rw-r--r--cesar/mac/sar/test/unit_test/ecos/override/ce/rx/src/rx.c88
-rw-r--r--cesar/mac/sar/test/unit_test/ecos/src/reassembly_measurement.c123
-rw-r--r--cesar/mac/sar/test/unit_test/ecos/src/tests.c6
-rw-r--r--cesar/mac/sar/test/unit_test/ecos/tests.h3
-rw-r--r--cesar/test_general/dataplane/src/test_dataplane.c16
-rw-r--r--cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c45
-rw-r--r--cesar/test_general/maximus/integration/hle-cl-sar-pbproc/src/station.c23
-rw-r--r--cesar/test_general/maximus/integration/interface-dp/src/station.c30
-rw-r--r--cesar/test_general/maximus/integration/ipmbox-hle-cl-sar-pbproc/src/station.c22
-rw-r--r--cesar/test_general/maximus/integration/sar-pbproc/src/station.c23
26 files changed, 246 insertions, 652 deletions
diff --git a/cesar/ce/rx/bitloading/test/src/test_fsm.c b/cesar/ce/rx/bitloading/test/src/test_fsm.c
index 8ad78b2b06..122f441a85 100644
--- a/cesar/ce/rx/bitloading/test/src/test_fsm.c
+++ b/cesar/ce/rx/bitloading/test/src/test_fsm.c
@@ -31,9 +31,9 @@ u8 ce_rx_bl_min_frame_with_high_pb_err_rate_;
static void
test_ce_rx_bl_measure_empty (ce_rx_measure_mbox_t *m)
{
- m->pb_measurements = NULL;
m->chan_data = NULL;
- m->pb_measurements_count = m->chan_data_count = 0;
+ m->chan_data_count = 0;
+ m->total_pb_count = m->false_pb_count = m->ber_sum = 0;
m->rx_params.tmi_av = 24;
m->rx_params.sound = false;
m->rx_params.sound_complete = false;
diff --git a/cesar/ce/rx/inc/measure.h b/cesar/ce/rx/inc/measure.h
index 26a215cc73..420ef676d8 100644
--- a/cesar/ce/rx/inc/measure.h
+++ b/cesar/ce/rx/inc/measure.h
@@ -46,21 +46,17 @@ typedef struct ce_rx_measure_mbox_t
*/
uint chan_data_count;
/**
- * Count of PB measurements.
- */
- uint pb_measurements_count;
- /**
- * PB measurements.
- */
- blk_t *pb_measurements;
- /**
- * Count of false PB (or -1 if none).
+ * Count of false PB (CRC wrong) in the frame.
*/
u8 false_pb_count;
/**
- * Total PB.
+ * Total count of PB in the frame.
*/
u8 total_pb_count;
+ /**
+ * BER sum of PBs with good CRC in the frame.
+ */
+ u32 ber_sum;
} ce_rx_measure_mbox_t;
diff --git a/cesar/ce/rx/inc/rx.h b/cesar/ce/rx/inc/rx.h
index 4000b11fb1..9be3e1174d 100644
--- a/cesar/ce/rx/inc/rx.h
+++ b/cesar/ce/rx/inc/rx.h
@@ -125,10 +125,6 @@ struct ce_rx_t
*/
trace_buffer_t trace_verbose;
#endif
- /**
- * Get PB measurements from the SAR?
- */
- bool measure_get_pbm;
};
/**
diff --git a/cesar/ce/rx/measure.h b/cesar/ce/rx/measure.h
index 526e3e3046..409b751f0e 100644
--- a/cesar/ce/rx/measure.h
+++ b/cesar/ce/rx/measure.h
@@ -34,22 +34,19 @@ BEGIN_DECLS
* Call back called by the SAR to give the measures.
* \param data the context of the CE RX.
* \param rx_params general information on measures (date, from).
- * \param pbm_count number of PB measurements available.
- * \param first_pbm the first block used to store the PB measurements.
- * \param last_pbm the last block used to store the PB measurements.
+ * \param total_pb_count number of PBs available in the frame.
* \param chan_data the head of the channel data.
* \param chan_data_count the count of PBs in the channel data.
* \param false_pb_count number of false PBs (CRC error) inside the frame.
- * \return true if there are one or more blocks allocated to store the
- * measurements.
+ * \param ber_sum BER sum of each PBs with no CRC error inside the frame.
*
* Have a look at \sa sar_measurement_cb_t.
*/
-bool
+void
ce_rx_measure_sar_cb (void *data, pbproc_rx_params_t *rx_params,
- uint pbm_count, blk_t **first_pbm, blk_t **last_pbm,
- pb_t *chan_data, uint chan_data_count,
- u8 **false_pb_count);
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count,
+ u32 ber_sum);
END_DECLS
diff --git a/cesar/ce/rx/src/measure.c b/cesar/ce/rx/src/measure.c
index 961caecf26..6c30a97041 100644
--- a/cesar/ce/rx/src/measure.c
+++ b/cesar/ce/rx/src/measure.c
@@ -17,30 +17,6 @@
#include "ce/rx/inc/rx.h"
#include "lib/utils.h"
-
-/**
- * Do we need to get the PB measurements from the SAR?
- * \param ce_rx the CE/RX context.
- * \param rx_params the RX parameters.
- * \param pbm_count number of PB measurements possible to get.
- * \return true if we need to get the PB measurements, false otherwise.
- *
- * This function will be quite useful to optimize the performance, in order to
- * get the PB measurements only when required.
- */
-static inline bool
-ce_rx_measure_get_pbm (ce_rx_t *ce_rx, pbproc_rx_params_t *rx_params,
- uint pbm_count)
-{
- /* Check parameters. */
- dbg_assert (ce_rx);
-
- /* PB measurements enabled and some PB measurements? */
- if (ce_rx->measure_get_pbm && pbm_count)
- return true;
- return false;
-}
-
/**
* Destructor for a measure.
*/
@@ -54,104 +30,57 @@ ce_rx_measure_cache_destructor (void *object)
if (measure->chan_data_count)
blk_release_desc_range_nb ((blk_t *) measure->chan_data,
measure->chan_data_count);
- if (measure->pb_measurements_count)
- blk_release_desc_range_nb (measure->pb_measurements,
- CEIL_DIV (measure->pb_measurements_count *
- sizeof (pb_measurement_t),
- BLK_SIZE));
}
-bool
+void
ce_rx_measure_sar_cb (void *data, pbproc_rx_params_t *rx_params,
- uint pbm_count, blk_t **first_pbm, blk_t **last_pbm,
- pb_t *chan_data, uint chan_data_count,
- u8 **false_pb_count)
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count,
+ u32 ber_sum)
{
- /* Check needed parameters. */
- dbg_assert (data);
+ /* Check parameter required for test. */
dbg_assert (rx_params);
- /* When this callback is called by the SAR, there is always something to
- * do. There is no case when there is nothing to do. */
- dbg_assert (chan_data_count || pbm_count);
- /* Get the context of the CE RX. */
- ce_rx_t *ce_rx = (ce_rx_t *) data;
+ /* Only handle measures for a "valid" STA. */
+ if (MAC_TEI_IS_STA (rx_params->tei))
+ {
+ /* Check all parameters. */
+ dbg_assert (data);
+ /* We must have something to do. */
+ dbg_assert (chan_data || total_pb_count);
- /* No PB measurements by default. */
- bool ret = false;
+ /* Get the context of the CE RX. */
+ ce_rx_t *ce_rx = (ce_rx_t *) data;
- CE_RX_TRACE_VERBOSE (SAR_CB, rx_params->tei, chan_data_count, pbm_count);
+ /* Trace it. */
+ CE_RX_TRACE_VERBOSE (SAR_CB, rx_params->tei, chan_data_count, total_pb_count);
- if (false_pb_count)
- /* By default, do not get false PB count. */
- *false_pb_count = NULL;
+ /* Allocate a measure. */
+ ce_rx_measure_mbox_t *measure = slab_alloc (&ce_rx->measure_cache);
- /* Only handle measures for a "valid" STA. */
- if (MAC_TEI_IS_STA (rx_params->tei))
- {
- /* Even if we have something to do, sometimes we do not want. */
- /* Get PB measurements? */
- bool get_pbm = ce_rx_measure_get_pbm (ce_rx, rx_params, pbm_count);
- /* Something to get? */
- if (chan_data_count || (get_pbm || pbm_count))
+ /* Copy needed information. */
+ measure->rx_params = *rx_params;
+ measure->total_pb_count = total_pb_count;
+ measure->false_pb_count = false_pb_count;
+ measure->ber_sum = ber_sum;
+
+ /* Any channel data? */
+ measure->chan_data_count = chan_data_count;
+ if (chan_data_count)
{
- /* Allocate a measure. */
- ce_rx_measure_mbox_t *measure = slab_alloc (&ce_rx->measure_cache);
- /* Copy needed information. */
- measure->rx_params = *rx_params;
-
- measure->false_pb_count = 0;
- measure->total_pb_count = pbm_count;
- if (false_pb_count)
- /* Get count of false PB. */
- *false_pb_count = &measure->false_pb_count;
-
- /* Any channel data? */
- measure->chan_data_count = chan_data_count;
- if (chan_data_count)
- {
- dbg_assert (chan_data);
- measure->chan_data = (phy_chandata_t *) chan_data;
- }
- else
- {
- dbg_invalid_ptr (measure->chan_data);
- }
-
- /* Any PB measurements to get? */
- if (get_pbm)
- {
- dbg_assert (first_pbm);
- dbg_assert (last_pbm);
- dbg_assert (pbm_count);
- dbg_assert (false_pb_count);
-
- measure->pb_measurements_count = pbm_count;
- /* Allocate necessary blocks directly it stores it in the SAR
- * variables. */
- *first_pbm
- = blk_alloc_desc_range (CEIL_DIV (measure->pb_measurements_count
- * sizeof (pb_measurement_t),
- BLK_SIZE),
- last_pbm);
- /* Store PB measurements in the measure. */
- measure->pb_measurements = *first_pbm;
- ret = true;
- }
- else
- {
- measure->pb_measurements_count = 0;
- dbg_invalid_ptr (measure->pb_measurements);
- }
-
- /* Add the measure to the mailbox. */
- mbox_put (&ce_rx->measure_mbox, &measure->mbox_node);
- /* Wake up the CE RX. */
- ce_rx_work_add (ce_rx, CE_RX_WORK_FLAG_MEASURE);
+ dbg_assert (chan_data);
+ measure->chan_data = (phy_chandata_t *) chan_data;
+ }
+ else
+ {
+ dbg_invalid_ptr (measure->chan_data);
}
- }
- return ret;
+ /* Add the measure to the mailbox. */
+ mbox_put (&ce_rx->measure_mbox, &measure->mbox_node);
+ /* Wake up the CE RX. */
+ ce_rx_work_add (ce_rx, CE_RX_WORK_FLAG_MEASURE);
+ }
}
void
@@ -168,8 +97,6 @@ ce_rx_measure_init (ce_rx_t *ce_rx, sar_t *sar, pbproc_t *pbproc)
slab_cache_init (&ce_rx->measure_cache, "ce_rx_measure",
sizeof (ce_rx_measure_mbox_t),
&ce_rx_measure_cache_destructor);
- /* Disable PB measurements for the moment being (FIXME). */
- ce_rx->measure_get_pbm = false;
/* Register our callback to get measures. */
sar_init_measure_context (sar, ce_rx);
sar_init_measurement_cb (sar, ce_rx_measure_sar_cb);
diff --git a/cesar/ce/rx/src/rx.c b/cesar/ce/rx/src/rx.c
index c046e5b9b5..f8bb6bbd0e 100644
--- a/cesar/ce/rx/src/rx.c
+++ b/cesar/ce/rx/src/rx.c
@@ -206,7 +206,7 @@ ce_rx_process_work_measure (ce_rx_t *ce_rx)
CE_RX_TRACE_VERBOSE (MEASURE_HANDLING, measure->rx_params.tei,
measure->rx_params.tmi_av,
measure->chan_data_count,
- measure->pb_measurements_count,
+ measure->total_pb_count,
measure->rx_params.sound,
measure->rx_params.sound_complete);
diff --git a/cesar/ce/rx/src/trace.c b/cesar/ce/rx/src/trace.c
index 95a9707ccc..148e782239 100644
--- a/cesar/ce/rx/src/trace.c
+++ b/cesar/ce/rx/src/trace.c
@@ -70,7 +70,7 @@ ce_rx_trace_init (ce_rx_t *ctx)
TRACE_EVENT (CE_RX_TRACE_INIT, "init"),
TRACE_EVENT (CE_RX_TRACE_UNINIT, "uninit"),
TRACE_EVENT (CE_RX_TRACE_MEASURE_HANDLING, "Handling measure for "
- "TEI %d on TMI %d: CD = %d & PBM = %d (Si = %d, "
+ "TEI %d on TMI %d: CD = %d & PBs = %d (Si = %d, "
"SC = %d)"),
TRACE_EVENT (CE_RX_TRACE_SAR_CB, "Callback from SAR for TEI %d: "
"CD = %d & PBM = %d"),
diff --git a/cesar/ce/rx/stub/src/rx.c b/cesar/ce/rx/stub/src/rx.c
index ff45ef2798..6ccd3650d2 100644
--- a/cesar/ce/rx/stub/src/rx.c
+++ b/cesar/ce/rx/stub/src/rx.c
@@ -22,21 +22,13 @@
static ce_rx_t ce_rx;
-bool
-ce_measurement (void *user, pbproc_rx_params_t *rx_params,
- uint pb_nb, blk_t **first_blk, blk_t **last_blk,
- pb_t *chan_data, uint nb_chandata, u8 **pb_false_count)
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
{
- if (nb_chandata)
- blk_release_desc_range_nb ((blk_t *) chan_data, nb_chandata);
-
- if (pb_false_count)
- {
- dbg_assert (pb_nb);
- *pb_false_count = NULL;
- }
-
- return false;
+ if (chan_data)
+ blk_release_desc_range_nb ((blk_t*) chan_data, chan_data_count);
}
ce_rx_t *
@@ -48,7 +40,7 @@ ce_rx_init (mac_store_t *mac_store, sar_t *sar, pbproc_t *pbproc,
mac_config_t *mac_config)
{
sar_init_measure_context (sar, NULL);
- sar_init_measurement_cb (sar, ce_measurement);
+ sar_init_measurement_cb (sar, ce_measurements);
return &ce_rx;
}
diff --git a/cesar/ce/rx/test/src/test_rx.c b/cesar/ce/rx/test/src/test_rx.c
index 322207d55b..b3c080161d 100644
--- a/cesar/ce/rx/test/src/test_rx.c
+++ b/cesar/ce/rx/test/src/test_rx.c
@@ -71,7 +71,7 @@ test_rx_ce_suite (test_t t)
}
void
-test_ce_rx_measure_suite (test_t t, bool measure_get_pbm)
+test_ce_rx_measure_suite (test_t t)
{
pbproc_rx_params_t rx_params;
rx_params.tei = 1;
@@ -79,27 +79,17 @@ test_ce_rx_measure_suite (test_t t, bool measure_get_pbm)
sar_t *sar = sar_init (mac_store, NULL, NULL, 0x1);
pbproc_t *pbproc = (pbproc_t *) t;
mac_config_t mac_config;
- u8 *false_pb;
- dbg_invalid_ptr (false_pb);
ce_rx_t *ce_rx = ce_rx_init (mac_store, sar, pbproc, &mac_config);
- if (measure_get_pbm)
- test_case_begin (t, "measure with PB measurement enabled");
- else
- test_case_begin (t, "measure with PB measurement disabled");
-
- ce_rx->measure_get_pbm = measure_get_pbm;
-
- test_begin (t, "no RX params, no channel data & no PB measurements")
+ test_begin (t, "no RX params, no channel data & no PB stats")
{
bool catch = false;
char *message;
mbox_size = 1;
dbg_fatal_try_begin
{
- ce_rx_measure_sar_cb (ce_rx, NULL, 0, NULL, NULL, NULL, 0,
- &false_pb);
+ ce_rx_measure_sar_cb (ce_rx, NULL, 0, NULL, 0, 0, 0);
}
dbg_fatal_try_catch (message)
{
@@ -113,15 +103,14 @@ test_ce_rx_measure_suite (test_t t, bool measure_get_pbm)
test_fail_if (mbox_peek (&ce_rx->measure_mbox) != 0);
} test_end;
- test_begin (t, "some RX params, but no channel data & no PB measurements")
+ test_begin (t, "some RX params, but no channel data & no PB stats")
{
bool catch = false;
char *message;
mbox_size = 1;
dbg_fatal_try_begin
{
- ce_rx_measure_sar_cb (ce_rx, &rx_params, 0, NULL, NULL, NULL, 0,
- &false_pb);
+ ce_rx_measure_sar_cb (ce_rx, &rx_params, 0, NULL, 0, 0, 0);
}
dbg_fatal_try_catch (message)
{
@@ -135,90 +124,35 @@ test_ce_rx_measure_suite (test_t t, bool measure_get_pbm)
test_fail_if (mbox_peek (&ce_rx->measure_mbox) != 0);
} test_end;
- test_begin (t, "some RX params & some channel data & no PB measurements")
+ test_begin (t, "some RX params & some channel data & no PB stats")
{
pb_t *pb = (pb_t *) blk_alloc_desc ();
mbox_size = 1;
- ce_rx_measure_sar_cb (ce_rx, &rx_params, 0, NULL, NULL, pb, 1,
- &false_pb);
+ ce_rx_measure_sar_cb (ce_rx, &rx_params, 0, pb, 1, 0, 0);
test_fail_if (test_measure == NULL);
test_fail_if (test_measure->chan_data_count != 1);
test_fail_if (test_measure->chan_data != (phy_chandata_t *) pb);
- test_fail_if (test_measure->pb_measurements_count != 0);
test_fail_if (test_measure->total_pb_count != 0);
test_fail_if (test_measure->false_pb_count != 0);
+ test_fail_if (test_measure->ber_sum != 0);
test_fail_if (mbox_size != 0);
/* Resume CE thread. */
cyg_thread_resume (ce_rx->thread_handler);
test_fail_if (mbox_peek (&ce_rx->measure_mbox) != 0);
} test_end;
- test_begin (t, "some RX params & some channel data & one PB measurements")
+ test_begin (t, "some RX params & some channel data & PB stats")
{
pb_t *pb = (pb_t *) blk_alloc_desc ();
- blk_t *fpm = NULL, *lpm = NULL;
mbox_size = 1;
- false_pb = NULL;
- ce_rx_measure_sar_cb (ce_rx, &rx_params, 1, &fpm, &lpm, pb, 1,
- &false_pb);
+ ce_rx_measure_sar_cb (ce_rx, &rx_params, 42, pb, 1, 24, 4242);
test_fail_if (mbox_size != 0);
test_fail_if (test_measure == NULL);
test_fail_if (test_measure->chan_data_count != 1);
test_fail_if (test_measure->chan_data != (phy_chandata_t *) pb);
- test_fail_if (test_measure->total_pb_count != 1);
- test_fail_if (&test_measure->false_pb_count != false_pb);
- if (measure_get_pbm)
- {
- test_fail_if (fpm == NULL);
- test_fail_if (lpm == NULL);
- test_fail_if (fpm != lpm);
- test_fail_if (test_measure->pb_measurements_count != 1);
- test_fail_if (test_measure->pb_measurements != fpm);
- }
- else
- {
- test_fail_if (fpm != NULL);
- test_fail_if (lpm != NULL);
- test_fail_if (test_measure->pb_measurements_count != 0);
- }
- /* Resume CE thread. */
- cyg_thread_resume (ce_rx->thread_handler);
- test_fail_if (mbox_peek (&ce_rx->measure_mbox) != 0);
- } test_end;
-
- test_begin (t, "some RX params & some channel data & many PB measurements")
- {
- pb_t *pb = (pb_t *) blk_alloc_desc ();
- blk_t *fpm = NULL, *lpm = NULL;
- mbox_size = 1;
- false_pb = NULL;
- /* More than one block of PB measurements. */
- ce_rx_measure_sar_cb (ce_rx, &rx_params,
- BLK_SIZE / sizeof (pb_measurement_t) + 1,
- &fpm, &lpm, pb, 1, &false_pb);
- test_fail_if (test_measure == NULL);
- test_fail_if (test_measure->chan_data_count != 1);
- test_fail_if (test_measure->chan_data != (phy_chandata_t *) pb);
- test_fail_if (mbox_size != 0);
- test_fail_if (test_measure->total_pb_count
- != BLK_SIZE / sizeof (pb_measurement_t) + 1);
- test_fail_if (&test_measure->false_pb_count != false_pb);
- if (measure_get_pbm)
- {
- test_fail_if (fpm == NULL);
- test_fail_if (lpm == NULL);
- test_fail_if (fpm == lpm);
- test_fail_if (fpm->next != lpm);
- test_fail_if (test_measure->pb_measurements_count != BLK_SIZE / sizeof
- (pb_measurement_t) + 1);
- test_fail_if (test_measure->pb_measurements != fpm);
- }
- else
- {
- test_fail_if (fpm != NULL);
- test_fail_if (lpm != NULL);
- test_fail_if (test_measure->pb_measurements_count != 0);
- }
+ test_fail_if (test_measure->total_pb_count != 42);
+ test_fail_if (test_measure->false_pb_count != 24);
+ test_fail_if (test_measure->ber_sum != 4242);
/* Resume CE thread. */
cyg_thread_resume (ce_rx->thread_handler);
test_fail_if (mbox_peek (&ce_rx->measure_mbox) != 0);
@@ -293,8 +227,7 @@ test_rx_ce_thread (cyg_addrword_t data)
test_rx_ce_suite (test);
- test_ce_rx_measure_suite (test, true);
- test_ce_rx_measure_suite (test, false);
+ test_ce_rx_measure_suite (test);
test_ce_rx_get_snr (test);
diff --git a/cesar/mac/sar/sar.h b/cesar/mac/sar/sar.h
index 0d165c2ea3..83a8f65188 100644
--- a/cesar/mac/sar/sar.h
+++ b/cesar/mac/sar/sar.h
@@ -24,30 +24,21 @@
typedef struct sar_t sar_t;
/**
- * Pb measurement RX callback for Channel estimation.
- * \param user User data
- * \param rx_params Frame control information to know date and tonemap used
- * \param pb_nb number of pbs
- * \param first blk to insert the measurements.
- * \param last blk to insert the measurements.
- * \param chandata chan data measurements
- * \param ce_pb_crc_error the number of segment received with the CRC error.
- * \return boolean to indicate if a block had been returned or not.
- *
- * This call back will return one or two block in order to insert all the
- * measurements contained in each PB of the mpdu received.
- * Two cases can happen, the first the pb_nb is lesser than the blk capacity,
- * this callback will return only a blk pointed by the first and the last
- * pointer.
- * In the second case the quantity of PB are greater than one blk capacity, this
- * callback will return two blk (chained) the first pointed by the first pointer
- * and the last one by the last pointer.
- */
-typedef bool
-(*sar_measurement_cb_t) (void *user,
- pbproc_rx_params_t *rx_params, uint pb_nb, blk_t **first,
- blk_t **last, pb_t *chan_data_first, uint nb_chandata,
- u8 **pb_crc_error);
+ * Call back prototype to provide measure to the CE.
+ * \param data the context of the CE RX.
+ * \param rx_params general information on measures (date, from).
+ * \param total_pb_count number of PB available in the frame.
+ * \param chan_data the head of the channel data.
+ * \param chan_data_count the count of PBs in the channel data.
+ * \param false_pb_count number of false PBs (CRC error) inside the frame.
+ * \param ber_sum sum of each BER of each PBs with no CRC error inside the
+ * frame
+ */
+typedef void
+(*sar_measurement_cb_t) (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count,
+ u32 ber_sum);
/**
* Segmentation job done for the segmentation module, it send a data to inform
diff --git a/cesar/mac/sar/src/sar.c b/cesar/mac/sar/src/sar.c
index a1dc70d5dd..9f68bcae02 100644
--- a/cesar/mac/sar/src/sar.c
+++ b/cesar/mac/sar/src/sar.c
@@ -1057,9 +1057,9 @@ sar_reassembly_run (sar_t *ctx, sar_mpdu_t *rx)
dbg_assert (!rx->rx.mfs);
dbg_assert (!rx->rx.mfs_mme);
/* Channel data ownership is handed over to callee. */
- (*ctx->sar_measurement) (ctx->ul_ce_ctx, &rx->rx.params, 0, NULL,
- NULL, rx->rx.chandata_first,
- rx->rx.chandata_nb, NULL);
+ ctx->sar_measurement (ctx->ul_ce_ctx, &rx->rx.params, 0,
+ rx->rx.chandata_first, rx->rx.chandata_nb,
+ 0, 0);
}
else
{
@@ -1116,16 +1116,8 @@ sar_rx_mpdu_process (sar_t *ctx, sar_mpdu_t * rx)
mfs_rx_t *mfs_current = NULL;
pb_t *pb_current = NULL;
bool mme = false;
-
- blk_t *blk_first;
- blk_t *blk_last;
- blk_t *blk_current;
- uint blk_offset = 0;
- bool collect_measure;
u8 pb_crc_error = 0;
- u8 *ce_pb_crc_error;
u32 ber_sum = 0;
- dbg_invalid_ptr(ce_pb_crc_error);
/* Statistics variables. */
uint pb_data_nb = 0;
uint pb_data_dropped = 0;
@@ -1140,13 +1132,6 @@ sar_rx_mpdu_process (sar_t *ctx, sar_mpdu_t * rx)
dbg_assert (ctx->sar_measurement);
- /* Call the CE to get the blocks to put the measurements. Channel data
- * ownership is handed over to callee. */
- collect_measure = (*ctx->sar_measurement) (ctx->ul_ce_ctx,
- &rx->rx.params, rx->rx.pb_nb, &blk_first, &blk_last,
- rx->rx.chandata_first, rx->rx.chandata_nb, &ce_pb_crc_error);
- blk_current = blk_first;
-
/* Initialise data. */
rx_head = rx->rx.pb_first;
/* The current PB pointing a PB in the MFS current. This can evolve and
@@ -1162,26 +1147,6 @@ sar_rx_mpdu_process (sar_t *ctx, sar_mpdu_t * rx)
/* Refresh Leon cache for the PB. Load both PB header and PB
* Measurements. */
arch_load_cache ((u32 *) &rx_head->header, 2);
-
- /* Collect measure for the CE. */
- if (collect_measure)
- {
- dbg_assert (blk_last);
- dbg_assert (blk_current);
-
- if (blk_offset == (BLK_SIZE / sizeof (pb_measurement_t)))
- {
- blk_current = blk_last;
- blk_offset = 0;
- }
-
- *((pb_measurement_t *) blk_current->data + blk_offset)
- = rx_head->phy_pb.pb_rx.pb_measurement;
- /* PB measurements are 1 word long and blk_current data is
- * handled as a pb_measurement. */
- blk_offset ++;
- }
-
/* If PB is not valid, crc error or Data not encrypt, Drop the PB.*/
if (!rx_head->header.vpbf
|| rx_head->phy_pb.pb_rx.pb_measurement.crc_error
@@ -1190,6 +1155,8 @@ sar_rx_mpdu_process (sar_t *ctx, sar_mpdu_t * rx)
{
if (rx_head->phy_pb.pb_rx.pb_measurement.crc_error)
pb_crc_error ++;
+ else
+ ber_sum += rx_head->phy_pb.pb_rx.pb_measurement.ber;
SAR_TRACE (PB_ERROR, rx_head->header.ssn);
rx_head = sar_pb_release (rx_head);
}
@@ -1281,12 +1248,10 @@ sar_rx_mpdu_process (sar_t *ctx, sar_mpdu_t * rx)
rx_head = sar_pb_release (rx_head);
}
}
-
- if (ce_pb_crc_error)
- {
- dbg_claim_ptr (ce_pb_crc_error);
- *ce_pb_crc_error = pb_crc_error;
- }
+ /* Call the CE. */
+ ctx->sar_measurement (ctx->ul_ce_ctx, &rx->rx.params, rx->rx.pb_nb,
+ rx->rx.chandata_first, rx->rx.chandata_nb,
+ pb_crc_error, ber_sum);
#if CONFIG_STATS
/* Increase statistics. */
ctx->stats.rx_pb_count += rx->rx.pb_nb;
diff --git a/cesar/mac/sar/test/functional/src/sar_rx.c b/cesar/mac/sar/test/functional/src/sar_rx.c
index 8c634be70b..455c98bc41 100644
--- a/cesar/mac/sar/test/functional/src/sar_rx.c
+++ b/cesar/mac/sar/test/functional/src/sar_rx.c
@@ -242,7 +242,7 @@ test_thread_process (cyg_addrword_t data)
sar_init_reassembly_data_cb (sar_ctx, rea_comp_sar_rea_done);
sar_init_reassembly_mme_cb (sar_ctx, rea_comp_sar_rea_done);
sar_init_measure_context (sar_ctx, sar_ctx);
- sar_init_measurement_cb (sar_ctx, ce_measurements_none);
+ sar_init_measurement_cb (sar_ctx, ce_measurements);
prepare_pbs (test);
diff --git a/cesar/mac/sar/test/functional/src/sar_tx.c b/cesar/mac/sar/test/functional/src/sar_tx.c
index 51024f0a4f..220b9a013c 100644
--- a/cesar/mac/sar/test/functional/src/sar_tx.c
+++ b/cesar/mac/sar/test/functional/src/sar_tx.c
@@ -206,7 +206,7 @@ test_thread_process (cyg_addrword_t data)
sar_init_data_context (sar_ctx, sar_ctx);
sar_init_mme_context (sar_ctx, sar_ctx);
- sar_init_measurement_cb (sar_ctx, ce_measurements_none);
+ sar_init_measurement_cb (sar_ctx, ce_measurements);
sar_init_segmentation_data_cb (sar_ctx, segmentation_done);
sar_init_segmentation_mme_cb (sar_ctx, segmentation_done);
diff --git a/cesar/mac/sar/test/functional/src/test_functions.c b/cesar/mac/sar/test/functional/src/test_functions.c
index c59a05f37d..86acf36f2b 100644
--- a/cesar/mac/sar/test/functional/src/test_functions.c
+++ b/cesar/mac/sar/test/functional/src/test_functions.c
@@ -48,20 +48,13 @@ static uint nb_frames_tx;
static uint nb_frames_rx;
/* Stubbed Functions. */
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
{
- if (chandata)
- blk_release_desc_range_nb ((blk_t*) chandata, nb_chandata);
-
- if (pb_nb)
- {
- dbg_assert (ce_pb_crc_error);
- *ce_pb_crc_error = NULL;
- }
- return false;
+ if (chan_data)
+ blk_release_desc_range_nb ((blk_t*) chan_data, chan_data_count);
}
static void
@@ -115,7 +108,7 @@ sar_test_init (sar_test_ctx_t *test_ctx)
2);
/* CE. */
sar_init_measure_context (test_ctx->sar, INVALID_PTR);
- sar_init_measurement_cb (test_ctx->sar, ce_measurements_none);
+ sar_init_measurement_cb (test_ctx->sar, ce_measurements);
sar_init_data_context (test_ctx->sar, INVALID_PTR);
sar_init_segmentation_data_cb (test_ctx->sar,
sar_test_segmentation_done__do_nothing);
diff --git a/cesar/mac/sar/test/functional/test_functions.h b/cesar/mac/sar/test/functional/test_functions.h
index ca91ce7ed5..0fbfa36b10 100644
--- a/cesar/mac/sar/test/functional/test_functions.h
+++ b/cesar/mac/sar/test/functional/test_functions.h
@@ -25,11 +25,10 @@ typedef struct sar_test_ctx_t sar_test_ctx_t;
BEGIN_DECLS
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8
- **ce_pb_crc_error)__attribute__((weak));
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum);
/**
* Initialise the test context.
diff --git a/cesar/mac/sar/test/unit_test/ecos/override/ce/rx/rx.h b/cesar/mac/sar/test/unit_test/ecos/override/ce/rx/rx.h
index 6adb904f25..a3129b4274 100644
--- a/cesar/mac/sar/test/unit_test/ecos/override/ce/rx/rx.h
+++ b/cesar/mac/sar/test/unit_test/ecos/override/ce/rx/rx.h
@@ -17,29 +17,17 @@
#include "mac/pbproc/pbproc.h"
#include "mac/sar/sar.h"
-struct ce_store_rx_params_t
-{
- struct ce_store_rx_params_t *next;
- pbproc_rx_params_t *rx_params;
-};
-typedef struct ce_store_rx_params_t ce_store_rx_params_t;
-
struct ce_rx_t
{
- blk_t *measurement_head;
- blk_t *measurement_tail;
-
- ce_store_rx_params_t *rx_params_head;
- ce_store_rx_params_t *rx_params_tail;
-
- pb_t *chandata;
- u8 mpdu_pb_crc_error;
+ /** BER sum. */
+ u32 ber_sum;
+ /** Total number of PBs. */
+ uint total_pb_count;
+ /** False PB count. */
+ uint false_pb_count;
};
typedef struct ce_rx_t ce_rx_t;
-/** Global context of the CE */
-ce_rx_t ce_ctx;
-
BEGIN_DECLS
ce_rx_t *
@@ -50,54 +38,20 @@ void
ce_rx_uninit (ce_rx_t *ce_rx);
/**
- * Pb measurement RX callback for Channel estimation.
- * \param user User data
- * \param rx_params Frame control information to know date and tonemap used
- * \param pb_nb number of pbs
- * \param first blk to insert the measurements.
- * \param last blk to insert the measurements.
- * \param chandata chan data measurements
- * \param ce_pb_crc_error the number of segment received with the CRC error.
- * \return boolean to indicate if a block had been returned or not.
- *
- * This call back will return one or two block in order to insert all the
- * measurements contained in each PB of the mpdu received.
- * Two cases can happen, the first the pb_nb is lesser than the blk capacity,
- * this callback will return only a blk pointed by the first and the last
- * pointer.
- * In the second case the quantity of PB are greater than one blk capacity, this
- * callback will return two blk (chained) the first pointed by the first pointer
- * and the last one by the last pointer.
- */
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)__attribute ((weak));
-
-/**
- * Pb measurement RX callback for Channel estimation.
- * \param user User data
- * \param rx_params Frame control information to know date and tonemap used
- * \param pb_nb number of pbs
- * \param first blk to insert the measurements.
- * \param last blk to insert the measurements.
- * \param chandata chan data measurements
- * \param ce_pb_crc_error the number of segment received with the CRC error.
- * \return boolean to indicate if a block had been returned or not.
- *
- * This call back will return one or two block in order to insert all the
- * measurements contained in each PB of the mpdu received.
- * Two cases can happen, the first the pb_nb is lesser than the blk capacity,
- * this callback will return only a blk pointed by the first and the last
- * pointer.
- * In the second case the quantity of PB are greater than one blk capacity, this
- * callback will return two blk (chained) the first pointed by the first pointer
- * and the last one by the last pointer.
+ * Call back called by the SAR to give the measures.
+ * \param data the context of the CE RX.
+ * \param rx_params general information on measures (date, from).
+ * \param total_pb_count number of PB available in the frame.
+ * \param chan_data the head of the channel data.
+ * \param chan_data_count the count of PBs in the channel data.
+ * \param false_pb_count number of false PBs (CRC error) inside the frame.
+ * \param ber_sum sum of each BER of each PBs with no CRC error inside the
+ * frame
*/
-bool
-ce_measurements_simu (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)__attribute ((weak));
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum);
END_DECLS
diff --git a/cesar/mac/sar/test/unit_test/ecos/override/ce/rx/src/rx.c b/cesar/mac/sar/test/unit_test/ecos/override/ce/rx/src/rx.c
index 93788dbebf..b9bba3cdde 100644
--- a/cesar/mac/sar/test/unit_test/ecos/override/ce/rx/src/rx.c
+++ b/cesar/mac/sar/test/unit_test/ecos/override/ce/rx/src/rx.c
@@ -13,94 +13,32 @@
* contains a minimum of the CE data to take the measurement of the PBs.
*
*/
-
#include "common/std.h"
#include "ce/rx/rx.h"
+static ce_rx_t ce_global;
+
ce_rx_t *
ce_rx_init (mac_store_t *mac_store, sar_t *sar, pbproc_t *pbproc,
mac_config_t *mac_config)
{
- ce_ctx.measurement_head = NULL;
- ce_ctx.measurement_tail = NULL;
- return &ce_ctx;
+ return &ce_global;
}
void
ce_rx_uninit (ce_rx_t *ce_rx)
{
- if (ce_ctx.measurement_head)
- {
- blk_release_desc_range ((blk_t*) ce_ctx.measurement_head,
- (blk_t*) ce_ctx.measurement_tail);
-
- }
}
-bool
-ce_measurements_simu (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
-{
- ce_rx_t *ctx = user;
- dbg_assert (user);
-
- if (pb_nb)
- {
- dbg_assert (ce_pb_crc_error);
- pb_t *pb_first = NULL;
- pb_t *pb_last = NULL;
-
- /* If the quantity of PBs are greater than 128 allocates two BLK */
- if (pb_nb > 128)
- {
- pb_first = (pb_t *) blk_alloc_desc_range (2, (blk_t **) &pb_last);
- pb_last->next = NULL;
- }
- else
- {
- pb_first = (pb_t *) blk_alloc_desc ();
- pb_last = pb_first;
- pb_last->next = NULL;
- }
-
- /* Keep it in the structure */
- if (ce_ctx.measurement_head == NULL)
- {
- ce_ctx.measurement_head = (blk_t *) pb_first;
- ce_ctx.measurement_tail = (blk_t *) pb_last;
- }
- else
- {
- ce_ctx.measurement_tail->next = (blk_t *) pb_first;
- ce_ctx.measurement_tail = (blk_t *) pb_last;
- }
- *first = (blk_t *) pb_first;
- *last = (blk_t *) pb_last;
-
- ((blk_t *)*last)->next = NULL;
- *ce_pb_crc_error = &ctx->mpdu_pb_crc_error;
- }
-
- if (chandata)
- blk_release_desc_range_nb ((blk_t *) chandata, nb_chandata);
-
- return true;
-}
-
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
{
- if (chandata)
- blk_release_desc_range_nb ((blk_t*) chandata, nb_chandata);
-
- if (pb_nb)
- {
- dbg_assert (ce_pb_crc_error);
- *ce_pb_crc_error = NULL;
- }
- return false;
+ ce_rx_t *ce = (ce_rx_t*) data;
+ if (chan_data)
+ blk_release_desc_range_nb ((blk_t*) chan_data, chan_data_count);
+ ce->ber_sum = ber_sum;
+ ce->total_pb_count = total_pb_count;
+ ce->false_pb_count = false_pb_count;
}
-
diff --git a/cesar/mac/sar/test/unit_test/ecos/src/reassembly_measurement.c b/cesar/mac/sar/test/unit_test/ecos/src/reassembly_measurement.c
index 71a46ab3cf..085e050578 100644
--- a/cesar/mac/sar/test/unit_test/ecos/src/reassembly_measurement.c
+++ b/cesar/mac/sar/test/unit_test/ecos/src/reassembly_measurement.c
@@ -13,88 +13,68 @@
#include "common/std.h"
#include "lib/blk.h"
#include "lib/test.h"
-#include "lib/trace.h"
-#include "lib/stats.h"
-
-#include "mac/sar/sar.h"
-#include "mac/common/store.h"
-#include "mac/common/ntb.h"
#include "ce/rx/rx.h"
-#include <string.h>
-
-#define NB_PB 200
-
#include "mac/sar/test/unit_test/ecos/tests.h"
void
-test_case_ce_measures (test_t test)
+test_ce_measures (test_t test, sar_test_t *t, bool crc_error, bool encrypted)
{
- uint i;
- pb_t *pb, *pb_last, *pb_curr = NULL;
- pbproc_rx_desc_t *rx_desc;
- ce_rx_t *ce_ctx;
- uint phy = 0;
- sar_test_t t;
-
- blk_t *blk_curr;
- uint blk_offset;
-
- sar_test_init (&t, &phy, INVALID_PTR);
- t.mac_config.ntb_offset_tck = 0;
- ce_ctx = ce_rx_init (INVALID_PTR, INVALID_PTR, INVALID_PTR, INVALID_PTR);
- sar_init_measure_context (t.sar, ce_ctx);
- sar_init_measurement_cb (t.sar, ce_measurements_simu);
- sar_activate (t.sar, true);
-
- pb = (pb_t *) blk_alloc_desc_range (NB_PB, (blk_t **) &pb_last);
-
- pb_last->next = NULL;
- pb_curr = pb;
- for (i = 0; i < NB_PB; i++)
+ u32 ber;
+ u16 ssn;
+ uint nb_eth_frames = 10;
+ test_within (test);
+ for (ssn = 0; ssn < 3*nb_eth_frames; ssn += 3)
{
- pb_curr->header.vpbf = false;
- pb_curr->phy_pb.pb_rx.pb_measurement.ber = i;
- pb_curr->phy_pb.pb_rx.pb_measurement.crc_error = i % 2;
- pb_curr = pb_curr->next;
+ pbproc_rx_desc_t *desc = (pbproc_rx_desc_t *) blk_alloc_desc ();
+ sar_mpdu_t *mpdu = PARENT_OF (sar_mpdu_t, rx, desc->rx);
+ sar_test_mpdu_default_fill (mpdu, 1, 1);
+ mpdu->rx.params.eks = encrypted ? MAC_EKS_MIN : MAC_EKS_CLEAR;
+ sar_test_mpdu_data_create (mpdu, 3, ssn, 0x123, false);
+ /* Put the CRC error flag in the second PB only if the crc_error flag
+ * is true. */
+ if (crc_error)
+ mpdu->rx.pb_first->next->phy_pb.pb_rx.pb_measurement.crc_error
+ = true;
+ mpdu->rx.pb_last->header.vpbf = false;
+ sar_mpdu_add (t->sar, desc);
+ /* The BER in the PB is set to the SSN value of the PB by the
+ * sar_test_mpdu_data_create function. So the BER sum is the sum
+ * of all the valids (vpbf == true and CRC error == false) SSN's of
+ * the MPDU. */
+ if (crc_error)
+ {
+ ber = ssn + (ssn + 2);
+ test_fail_unless (t->ce->false_pb_count == 1);
+ }
+ else
+ {
+ ber = ssn + (ssn + 1) + (ssn + 2);
+ test_fail_unless (t->ce->false_pb_count == 0);
+ }
+ test_fail_unless (t->ce->ber_sum == ber);
+ test_fail_unless (t->ce->total_pb_count == 3);
}
+}
- rx_desc = PARENT_OF (pbproc_rx_desc_t, blk, blk_alloc_desc ());
- memset (&rx_desc->rx->params, 0, sizeof (pbproc_rx_params_t));
- rx_desc->rx->params.lid = 0x1;
- rx_desc->rx->params.tei = 0x1;
- rx_desc->rx->params.bdf = false;
- rx_desc->rx->mfs = NULL;
- rx_desc->rx->mfs_mme = NULL;
- rx_desc->rx->pb_first = pb;
- rx_desc->rx->pb_last = pb_last;
- rx_desc->rx->pb_nb = NB_PB;
- rx_desc->rx->chandata_first = NULL;
- rx_desc->rx->chandata_nb = 0;
- sar_mpdu_add (t.sar, rx_desc);
-
- test_begin(test, "measurement")
+void
+test_case_ce_measures (test_t test)
+{
+ test_case_begin (test, "CE measures");
+ test_begin (test, "On multiples MPDUs")
{
- blk_curr = ce_ctx->measurement_head;
- blk_offset = 0;
-
- for (i = 0; i < NB_PB; i++)
- {
- if (blk_offset == (BLK_SIZE >> 2))
- {
- blk_curr = blk_curr->next;
- blk_offset = 0;
- }
-
- test_fail_unless (((pb_measurement_t *) blk_curr->data)
- [blk_offset].ber == i);
- blk_offset ++;
- }
- test_fail_unless (ce_ctx->mpdu_pb_crc_error == NB_PB / 2);
+ sar_test_t t;
+ sar_test_init (&t, INVALID_PTR, INVALID_PTR);
+ sar_activate (t.sar, true);
+ test_ce_measures (test, &t, false, true);
+ sar_cleanup (t.sar);
+ /* Make a test with a CRC false. */
+ test_ce_measures (test, &t, true, true);
+ /* Same test with a MPDU with data not encrypted. */
+ test_ce_measures (test, &t, true, false);
+ sar_cleanup (t.sar);
+ sar_test_uninit (&t);
}
test_end;
-
- sar_test_uninit (&t);
- ce_rx_uninit (ce_ctx);
}
void
@@ -102,7 +82,6 @@ test_suite_reassembly_ce_measures (test_t test)
{
test_suite_begin (test, "CE measures");
test_case_ce_measures (test);
-
test_begin (test, "Memory")
{
test_fail_if (blk_check_memory() == false, "Memory not freed");
diff --git a/cesar/mac/sar/test/unit_test/ecos/src/tests.c b/cesar/mac/sar/test/unit_test/ecos/src/tests.c
index f26cf71297..ea073296b2 100644
--- a/cesar/mac/sar/test/unit_test/ecos/src/tests.c
+++ b/cesar/mac/sar/test/unit_test/ecos/src/tests.c
@@ -75,8 +75,9 @@ sar_test_init (sar_test_t *t, void *phy, void *pbproc)
mac_ntb_init ((phy_t*) t->phy, &t->mac_config);
lib_stats_init ();
t->sar = sar_init (t->mac_store, pbproc, INVALID_PTR, 123);
- sar_init_measure_context (t->sar, INVALID_PTR);
- sar_init_measurement_cb (t->sar, ce_measurements_none);
+ t->ce = ce_rx_init (t->mac_store, t->sar, pbproc, &t->mac_config);
+ sar_init_measure_context (t->sar, t->ce);
+ sar_init_measurement_cb (t->sar, ce_measurements);
sar_init_data_context (t->sar, t);
sar_init_mme_context (t->sar, t);
sar_init_segmentation_data_cb (t->sar, sar_test_segmentation_done);
@@ -314,6 +315,7 @@ sar_test_data_create (pb_t **first, pb_t **last, uint pb_nb, u16 ssn,
pb->header.vpbf = true;
pb->header.mmqf = false;
pb->header.mfbf = 0;
+ pb->phy_pb.pb_rx.pb_measurement.ber = pb->header.ssn;
if (rnd_crc_error && lib_rnd32 (&rnd) % 5 == 0)
pb->phy_pb.pb_rx.pb_measurement.crc_error = true;
else
diff --git a/cesar/mac/sar/test/unit_test/ecos/tests.h b/cesar/mac/sar/test/unit_test/ecos/tests.h
index 983faa856a..a4646dc766 100644
--- a/cesar/mac/sar/test/unit_test/ecos/tests.h
+++ b/cesar/mac/sar/test/unit_test/ecos/tests.h
@@ -14,6 +14,7 @@
*/
#include "mac/sar/inc/sar_context.h"
#include "lib/bitstream.h"
+#include "ce/rx/rx.h"
struct sar_test_bitstream_change_data_t
{
@@ -55,6 +56,8 @@ struct sar_test_t
mac_config_t mac_config;
/* Phy pointer. */
void *phy;
+ /* Ce context. */
+ ce_rx_t *ce;
/* Segmentation done context. */
struct sar_test_segmentation_complete_t seg_done;
/* Reassembly done context. */
diff --git a/cesar/test_general/dataplane/src/test_dataplane.c b/cesar/test_general/dataplane/src/test_dataplane.c
index f7916a9d40..5219ddc8b6 100644
--- a/cesar/test_general/dataplane/src/test_dataplane.c
+++ b/cesar/test_general/dataplane/src/test_dataplane.c
@@ -57,19 +57,15 @@ cp_mme_buffer_add (void *user_data, u8 *buffer)
#endif /* CONFIG_FCALL_MME */
/* Stub. */
-bool
-ce_measurements (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
{
- *first = NULL;
- *last = NULL;
- if (chandata)
- blk_release_desc_range_nb (&chandata->blk, nb_chandata);
+ if (chan_data)
+ blk_release_desc_range_nb (&chan_data->blk, chan_data_count);
/* Pretend it was encrypted. */
rx_params->eks = 1;
- *ce_pb_crc_error = NULL;
- return false;
}
static void
diff --git a/cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c b/cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c
index 8b377ec71b..57648d5b5a 100644
--- a/cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c
+++ b/cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c
@@ -887,44 +887,17 @@ int fc_cp_mme_send_as_mme (fcall_ctx_t *fcall, fcall_param_t **param,
// ---------------------------- Stub functions ----------------------------
-/**
- * CE measurements. To be replace by the CE function to get the measurements
- *
- * Pb measurement RX callback for Channel estimation.
- * This call back will return one or two block in order to insert all the
- * measurements contained in each PB of the mpdu received.
- * Two cases can happen, the first the pb_nb is lesser than the blk capacity,
- * this callback will return only a blk pointed by the first and the last
- * pointer.
- * In the second case the quantity of PB are greater than one blk capacity, this
- * callback will return two blk (chained) the first pointed by the first pointer
- * and the last one by the last pointer.
- *
- * \param user User data
- * \param rx_params Frame control information to know date and tonemap used
- * \param number of pbs
- * \param first blk to insert the measurements.
- * \param last blk to insert the measurements.
- * \param chandata chan data measurements
- *
- * \return boolean to indicate if a block had been returned or not.
- */
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
-{
- rx_params->eks = 0;
- if (chandata)
- {
- blk_release_desc_range_nb ((blk_t*) chandata, nb_chandata);
- }
- *ce_pb_crc_error = NULL;
- return false;
+// -------------------------------------------------------------------------
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
+{
+ if (chan_data)
+ blk_release_desc_range_nb ((blk_t*) chan_data, chan_data_count);
}
-// -------------------------------------------------------------------------
/** Cesar init function as described in the wiki
@@ -1022,7 +995,7 @@ cyg_user_start (void)
sar_init_measure_context (station_test.sar, &station_test.sar);
- sar_init_measurement_cb (station_test.sar, ce_measurements_none);
+ sar_init_measurement_cb (station_test.sar, ce_measurements);
/* Initialize the Upper communication when DATA or MME is sent over the
* PLC*/
diff --git a/cesar/test_general/maximus/integration/hle-cl-sar-pbproc/src/station.c b/cesar/test_general/maximus/integration/hle-cl-sar-pbproc/src/station.c
index a3a1f81d43..ad1f209937 100644
--- a/cesar/test_general/maximus/integration/hle-cl-sar-pbproc/src/station.c
+++ b/cesar/test_general/maximus/integration/hle-cl-sar-pbproc/src/station.c
@@ -1055,23 +1055,16 @@ int fc_cp_mme_send_as_data (fcall_ctx_t *fcall, fcall_param_t **param,
// ---------------------------- Stub functions ----------------------------
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
{
- dbg_assert (rx_params);
-
- rx_params->eks = 0x0;
- if (chandata)
- {
- blk_release_desc_range_nb ((blk_t *) chandata, nb_chandata);
- }
-
- *ce_pb_crc_error = NULL;
- return false;
+ if (chan_data)
+ blk_release_desc_range_nb ((blk_t*) chan_data, chan_data_count);
}
+
// -------------------------------------------------------------------------
@@ -1181,7 +1174,7 @@ cyg_user_start (void)
sar_init_measure_context (station_test.sar, &station_test.sar);
- sar_init_measurement_cb (station_test.sar, ce_measurements_none);
+ sar_init_measurement_cb (station_test.sar, ce_measurements);
return 0;
}
diff --git a/cesar/test_general/maximus/integration/interface-dp/src/station.c b/cesar/test_general/maximus/integration/interface-dp/src/station.c
index 7fe72514a7..3d99fe0358 100644
--- a/cesar/test_general/maximus/integration/interface-dp/src/station.c
+++ b/cesar/test_general/maximus/integration/interface-dp/src/station.c
@@ -396,29 +396,13 @@ cp_init (void)
&station_test.cp_thread);
}
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
{
- ce_rx_params_node_t *ce_node;
-
- *first = NULL;
- *last = NULL;
-
- dbg_assert (rx_params);
-
- ce_node = blk_alloc ();
- list_init_node (&ce_node->node);
- list_push (&ce_rx_params_list, &ce_node->node);
- ce_node->rx_params = *rx_params;
-
- if (chandata)
- {
- blk_release (chandata);
- }
- *ce_pb_crc_error = NULL;
- return false;
+ if (chan_data)
+ blk_release_desc_range_nb ((blk_t*) chan_data, chan_data_count);
}
@@ -544,7 +528,7 @@ cyg_user_start (void)
// Stub the CE functionalities.
sar_init_measure_context (station_test.sar, station_test.sar);
- sar_init_measurement_cb (station_test.sar, ce_measurements_none);
+ sar_init_measurement_cb (station_test.sar, ce_measurements);
// Stub the interface communication with the CP.
interface_callback_init (station_test.interface, cp_mme_recv,
diff --git a/cesar/test_general/maximus/integration/ipmbox-hle-cl-sar-pbproc/src/station.c b/cesar/test_general/maximus/integration/ipmbox-hle-cl-sar-pbproc/src/station.c
index 4959c4f499..12150b5fc4 100644
--- a/cesar/test_general/maximus/integration/ipmbox-hle-cl-sar-pbproc/src/station.c
+++ b/cesar/test_general/maximus/integration/ipmbox-hle-cl-sar-pbproc/src/station.c
@@ -833,21 +833,13 @@ int fc_cp_mme_send_as_data (fcall_ctx_t *fcall, fcall_param_t **param,
// ---------------------------- Stub functions ----------------------------
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
{
- dbg_assert (rx_params);
-
- rx_params->eks = 0x0;
-
- if (chandata)
- {
- blk_release_desc_range_nb ((blk_t *) chandata, nb_chandata);
- }
- *ce_pb_crc_error = NULL;
- return false;
+ if (chan_data)
+ blk_release_desc_range_nb ((blk_t*) chan_data, chan_data_count);
}
// -------------------------------------------------------------------------
@@ -951,7 +943,7 @@ cyg_user_start (void)
sar_init_measure_context (station_test.sar, &station_test.sar);
- sar_init_measurement_cb (station_test.sar, ce_measurements_none);
+ sar_init_measurement_cb (station_test.sar, ce_measurements);
hle_activate (station_test.hle, true);
station_test.mac_config.authenticated = true;
diff --git a/cesar/test_general/maximus/integration/sar-pbproc/src/station.c b/cesar/test_general/maximus/integration/sar-pbproc/src/station.c
index 5abf669388..9109d287e8 100644
--- a/cesar/test_general/maximus/integration/sar-pbproc/src/station.c
+++ b/cesar/test_general/maximus/integration/sar-pbproc/src/station.c
@@ -844,24 +844,15 @@ int fc_sar_print_trace (fcall_ctx_t *fcall, fcall_param_t **param,
// ---------------------------- Stub functions ----------------------------
-
-bool
-ce_measurements_none (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
- blk_t **first, blk_t **last, pb_t *chandata,
- uint nb_chandata, u8 **ce_pb_crc_error)
+void
+ce_measurements (void *data, pbproc_rx_params_t *rx_params,
+ uint total_pb_count, pb_t *chan_data,
+ uint chan_data_count, u8 false_pb_count, u32 ber_sum)
{
- dbg_assert (rx_params);
-
- if (chandata)
- {
- blk_release_desc_range_nb ((blk_t *) chandata, nb_chandata);
- }
-
- *ce_pb_crc_error = NULL;
- return false;
+ if (chan_data)
+ blk_release_desc_range_nb ((blk_t*) chan_data, chan_data_count);
}
-
/**
* CP receives a new MME.
* \param user_data the data registered by the actor in the init function.
@@ -994,7 +985,7 @@ cyg_user_start (void)
sar_init_reassembly_mme_cb (station_test.sar, sar_reassembly_mme_done);
sar_init_measure_context (station_test.sar, &station_test.sar);
- sar_init_measurement_cb (station_test.sar, ce_measurements_none);
+ sar_init_measurement_cb (station_test.sar, ce_measurements);
return 0;
}