summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlacour2008-03-26 13:51:24 +0000
committerlacour2008-03-26 13:51:24 +0000
commitd021e94f0caa474e341ea3c0a7bd8ed100feb655 (patch)
treef8d5f7e2d768d0337b19e3bd7767f975f5cc75a3
parent1663ebbf61ca50acdcc434d8f4cc34de734bd34c (diff)
Integration SAR :
rxce_init intialize sar callback. Change callback name in rxce. Add RXCE traces. Check available measure type before process. Add Flag SAR compilation to avoid sar_process run. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1636 017c9cb6-072f-447c-8318-d5b54f68fe89
-rwxr-xr-xce/inc/mpdu_measure_store.h4
-rwxr-xr-xce/inc/rx.h7
-rw-r--r--ce/src/bitloading.c35
-rwxr-xr-xce/src/mpdu_measure_store.c21
-rwxr-xr-xce/src/rx.c18
-rw-r--r--ce/src/trace.c12
-rwxr-xr-xce/test/cov/cov_all_run.sh2
-rwxr-xr-xce/test/rx/general/src/test_bitloading.c4
-rwxr-xr-xce/test/rx/general/src/test_mpdu_measure_store.c23
-rwxr-xr-xce/test/rx/general/src/test_rx.c10
-rwxr-xr-xce/test/rx/general/src/test_sar_integration.c7
-rw-r--r--ce/test/rx/general/target-Makefile3
-rw-r--r--ce/test/rx/maximus/Makefile3
-rw-r--r--ce/test/rx/maximus/src/test_rx.c11
-rw-r--r--ce/test/rx/tonemap_refresh/Makefile2
-rw-r--r--ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c5
-rw-r--r--mac/sar/inc/trace.h1
17 files changed, 100 insertions, 68 deletions
diff --git a/ce/inc/mpdu_measure_store.h b/ce/inc/mpdu_measure_store.h
index 19cde10483..f8b7f5e92d 100755
--- a/ce/inc/mpdu_measure_store.h
+++ b/ce/inc/mpdu_measure_store.h
@@ -106,7 +106,7 @@ mpdu_measure_store_release (mpdu_measure_store_t *ctx, mpdu_measure_t *measure);
bool // Was FIFO not full?
mpdu_measure_store_append (mpdu_measure_store_t *ctx, pbproc_rx_params_t *rx_params, uint pb_nb,
pb_measure_blk_t ** first, pb_measure_blk_t **last,
- phy_chandata_t *chandata_head, uint chandata_nb);
+ phy_chandata_t *chandata_head, uint chandata_nb, uint *blk_offset);
/**
* Add pb measurement in a MPDU measurement.
@@ -122,7 +122,7 @@ mpdu_measure_store_append (mpdu_measure_store_t *ctx, pbproc_rx_params_t *rx_par
* Otherwise, new allocation is done and pb_nb is reset.
*/
void
-mpdu_measure_pb_add (mpdu_measure_t *measure, uint pb_nb, pb_measure_blk_t **first, pb_measure_blk_t **last);
+mpdu_measure_pb_add (mpdu_measure_t *measure, uint pb_nb, pb_measure_blk_t **first, pb_measure_blk_t **last, uint *blk_offset);
/**
* Add a particular type noise measurement.
diff --git a/ce/inc/rx.h b/ce/inc/rx.h
index 1c7c3c6978..2f0ae3e2fb 100755
--- a/ce/inc/rx.h
+++ b/ce/inc/rx.h
@@ -19,6 +19,7 @@
#include "ce/inc/mpdu_measure_store.h"
#include "cyg/kernel/kapi.h"
#include "lib/trace.h"
+#include "mac/sar/sar.h"
#ifdef MAXIMUS_TEST
#define TXCE
#endif
@@ -93,7 +94,7 @@ BEGIN_DECLS
*
*/
rxce_t *
-rxce_init (mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx);
+rxce_init (sar_t *sar_ctx, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx);
/**
* Callback called by pbproc when it need to have a SCF i.e when it receives a
@@ -118,9 +119,9 @@ pbproc_need_scf_cb (uint tei, uint src);
* measurement.
*/
bool // does channel estimation need pb_measurement?
-sar_mpdu_measurement_cb (void *user, pbproc_rx_params_t *rx_params,
+rxce_mpdu_measurement_add (void *user, pbproc_rx_params_t *rx_params,
uint pb_nb, blk_t **first, blk_t **last,
- pb_t *noise, uint n);
+ pb_t *noise, uint n, uint *blk_offset);
/**
* Add a 'cei message job' for each tonemaps that must be updated and evaluate
diff --git a/ce/src/bitloading.c b/ce/src/bitloading.c
index b0f5b08dc3..381affaa23 100644
--- a/ce/src/bitloading.c
+++ b/ce/src/bitloading.c
@@ -78,7 +78,6 @@ bitloading_run (mac_store_t *mac_store_ctx, mpdu_measure_t *measure)
{
ret = bitloading_dynamic_step (ssta, measure);
}
- ssta->rxce.measurement_computed_nb++;
blk_release (ssta);
return ret;
}
@@ -94,23 +93,30 @@ bitloading_initial_step (sta_t *ssta, mpdu_measure_t *measure)
ret.stei = ssta->tei;
ret.changed_tonemaps = NULL;
{
- bitloading_worst_tonemap_compute (&ssta->rxce.tm_in_build, measure->chandata_head[PHY_CHANDATA_TYPE_NRJ]);
- if (ssta->rxce.measurement_computed_nb >= FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP)
+ if (measure->chandata_head[PHY_CHANDATA_TYPE_NRJ])
{
- tms->default_tmi = tonemap_set_first_free (tms, ssta->rxce.tm_in_build);
- ssta->rxce.tm_in_build = NULL;
- ret.changed_tonemaps = tms;
- ret.new_tmi = tms->default_tmi;
- ret.old_tmi = TONEMAP_INDEX_NULL;
+ bitloading_worst_tonemap_compute (&ssta->rxce.tm_in_build, measure->chandata_head[PHY_CHANDATA_TYPE_NRJ]);
+ if (ssta->rxce.measurement_computed_nb >= FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP)
+ {
+ tms->default_tmi = tonemap_set_first_free (tms, ssta->rxce.tm_in_build);
+ ssta->rxce.tm_in_build = NULL;
+ ret.changed_tonemaps = tms;
+ ret.new_tmi = tms->default_tmi;
+ ret.old_tmi = TONEMAP_INDEX_NULL;
+ }
}
+ ssta->rxce.measurement_computed_nb++;
}
- if (bitloading_mpdu_noise_stability (measure->chandata_head[PHY_CHANDATA_TYPE_NRJ_SYMBOL]))
+ if (measure->chandata_head[PHY_CHANDATA_TYPE_NRJ_SYMBOL])
{
- ssta->rxce.stable_ROBO_nb++;
- }
- else
- {
- ssta->rxce.unstable_ROBO_nb++;
+ if (bitloading_mpdu_noise_stability (measure->chandata_head[PHY_CHANDATA_TYPE_NRJ_SYMBOL]))
+ {
+ ssta->rxce.stable_ROBO_nb++;
+ }
+ else
+ {
+ ssta->rxce.unstable_ROBO_nb++;
+ }
}
return ret;
}
@@ -126,6 +132,7 @@ bitloading_dynamic_step (sta_t *sta, mpdu_measure_t *measure)
ret.new_tmi = TONEMAP_INDEX_NULL;
ret.old_tmi = TONEMAP_INDEX_NULL;
if (!sta->rxce.tm_in_build) sta->rxce.tm_in_build = tonemap_alloc ();
+ sta->rxce.measurement_computed_nb++;
return ret;
}
diff --git a/ce/src/mpdu_measure_store.c b/ce/src/mpdu_measure_store.c
index dadd4610cc..c1f6d051e5 100755
--- a/ce/src/mpdu_measure_store.c
+++ b/ce/src/mpdu_measure_store.c
@@ -139,7 +139,7 @@ mpdu_measure_store_get (mpdu_measure_store_t *ctx)
bool // Was FIFO not full?
mpdu_measure_store_append (mpdu_measure_store_t *ctx, pbproc_rx_params_t *rx_params, uint pb_nb,
pb_measure_blk_t **pb_first, pb_measure_blk_t **pb_last,
- phy_chandata_t *chandata_head, uint chandata_nb)
+ phy_chandata_t *chandata_head, uint chandata_nb, uint *blk_offset)
{
dbg_assert (ctx);
dbg_assert (!(chandata_nb==0 && chandata_head));
@@ -154,7 +154,7 @@ mpdu_measure_store_append (mpdu_measure_store_t *ctx, pbproc_rx_params_t *rx_par
{
mpdu_measure_t *measure = &ctx->store[ctx->tail];
measure->rx_params = rx_params;
- if (pb_nb) mpdu_measure_pb_add (measure, pb_nb, pb_first, pb_last);
+ if (pb_nb) mpdu_measure_pb_add (measure, pb_nb, pb_first, pb_last, blk_offset);
if (chandata_head) mpdu_measure_chandata_add (measure, chandata_head);
ctx->measure_nb++;
ctx->tail++;
@@ -165,7 +165,7 @@ mpdu_measure_store_append (mpdu_measure_store_t *ctx, pbproc_rx_params_t *rx_par
}
void
-mpdu_measure_pb_add (mpdu_measure_t *measure, uint pb_nb, pb_measure_blk_t **pb_first, pb_measure_blk_t **pb_last)
+mpdu_measure_pb_add (mpdu_measure_t *measure, uint pb_nb, pb_measure_blk_t **pb_first, pb_measure_blk_t **pb_last, uint *blk_offset)
{
dbg_assert (measure);
dbg_assert (pb_nb<=MAC_MAX_PB_PER_MPDU);
@@ -179,20 +179,26 @@ mpdu_measure_pb_add (mpdu_measure_t *measure, uint pb_nb, pb_measure_blk_t **pb_
if (stock->next)
{
dbg_assert ( (pb_nb + stock->next->pb_nb) <= MPDU_MEASURE_PB_NB_PER_BLK);
+ *blk_offset = stock->next->pb_nb;
+ stock->next->pb_nb += pb_nb;
*pb_first = *pb_last = stock->next;
}
else //Only one block is already used.
{
- *pb_first = stock;
dbg_assert ( (pb_nb+stock->pb_nb) <= MAC_MAX_PB_PER_MPDU);
+ *blk_offset = stock->pb_nb;
+ *pb_first = stock;
if (pb_nb + stock->pb_nb > MPDU_MEASURE_PB_NB_PER_BLK) //A second block is necessary
{
*pb_last = (pb_measure_blk_t *) blk_alloc_desc();
(*pb_first)->next = *pb_last;
+ stock->next->pb_nb = pb_nb + stock->pb_nb - MPDU_MEASURE_PB_NB_PER_BLK;
+ stock->pb_nb = MPDU_MEASURE_PB_NB_PER_BLK;
}
else // The first block is enough.
{
*pb_last = *pb_first;
+ stock->pb_nb += pb_nb;
}
}
}
@@ -201,21 +207,24 @@ mpdu_measure_pb_add (mpdu_measure_t *measure, uint pb_nb, pb_measure_blk_t **pb_
if (pb_nb > MPDU_MEASURE_PB_NB_PER_BLK) //Need two blocks
{
*pb_first = (pb_measure_blk_t *) blk_alloc_desc_range (2, (blk_t **) pb_last);
+ (*pb_first)->pb_nb = MPDU_MEASURE_PB_NB_PER_BLK;
+ (*pb_last)->pb_nb = pb_nb - MPDU_MEASURE_PB_NB_PER_BLK;
}
else // Need one block.
{
*pb_first = *pb_last = (pb_measure_blk_t *) blk_alloc_desc();
+ (*pb_first)->pb_nb = pb_nb;
}
// Initialize first block pb nb to 0. SAR will start from 0 and update
// the new value.
- (*pb_first)->pb_nb = 0;
+ *blk_offset = 0;
measure->pb_head = *pb_first;
}
(*pb_last)->next = NULL;
}
else
{
- *pb_first = NULL; *pb_last = NULL;
+ *pb_first = NULL; *pb_last = NULL; *blk_offset = 0;
}
}
diff --git a/ce/src/rx.c b/ce/src/rx.c
index 28d618799b..a1d25626af 100755
--- a/ce/src/rx.c
+++ b/ce/src/rx.c
@@ -12,7 +12,6 @@
*
* « long description »
*/
-//#include "../../config_test.h"
#include "common/std.h"
#include "common/defs/ethernet.h"
#include "ce/inc/rx.h"
@@ -37,7 +36,7 @@ rxce_init_test_cb (test_cb_t test)
#endif
rxce_t *
-rxce_init (mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
+rxce_init (sar_t *sar, mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
{
dbg_assert (mac_store_ctx);
dbg_assert (mac_config_ctx);
@@ -54,6 +53,11 @@ rxce_init (mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
ctx->pbproc_need_scf = false;
rxce_trace_init (ctx);
+#ifdef RXCE_WITH_SAR
+ dbg_assert (sar);
+ sar_init_measure_context (sar, ctx);
+ sar_init_measurement_cb (sar, rxce_mpdu_measurement_add);
+#endif
RXCE_TRACE (INIT, mac_ntb());
return (ctx);
}
@@ -75,8 +79,8 @@ pbproc_need_scf_cb (uint tei, uint reason_code)
}
bool
-sar_mpdu_measurement_cb (void *user, pbproc_rx_params_t *rx_params,
- uint pb_nb, blk_t **f, blk_t **l, pb_t *noise, uint n)
+rxce_mpdu_measurement_add (void *user, pbproc_rx_params_t *rx_params,
+ uint pb_nb, blk_t **f, blk_t **l, pb_t *noise, uint n, uint *blk_offset)
{
dbg_assert (user);
rxce_t *ctx = (rxce_t *) user;
@@ -86,7 +90,7 @@ sar_mpdu_measurement_cb (void *user, pbproc_rx_params_t *rx_params,
pb_measure_blk_t **first = (pb_measure_blk_t **) f;
pb_measure_blk_t **last = (pb_measure_blk_t **) l;
// Allocate block if necessary. The SAR will fill blocks after !couldn't be stopped by RXCE!.
- b = mpdu_measure_store_append (ctx->mpdu_measure_store_ctx, rx_params, pb_nb, first, last, (phy_chandata_t *) noise, n);
+ b = mpdu_measure_store_append (ctx->mpdu_measure_store_ctx, rx_params, pb_nb, first, last, (phy_chandata_t *) noise, n, blk_offset);
// Give 'job' to RXCE that will process the previous frame.
if (b) cyg_semaphore_post (&(ctx->job));
else RXCE_TRACE (MEASURE_DROPPED, mac_ntb());
@@ -204,7 +208,11 @@ void
rxce_process (cyg_addrword_t data)
{
dbg_assert (data);
+#ifdef EXPIRATION_TEST
cyg_tick_count_t watchdog = 0;
+#else
+ cyg_tick_count_t watchdog = 0xFFFFFFFFFFFFFFFFlu;
+#endif
mme_t *mme;
rxce_t *ctx = (rxce_t *) data;
while (true)
diff --git a/ce/src/trace.c b/ce/src/trace.c
index 3ed107aaad..95eee4c866 100644
--- a/ce/src/trace.c
+++ b/ce/src/trace.c
@@ -13,7 +13,6 @@
* « long description »
*/
#include "common/std.h"
-#include "ce/inc/rx.h"
#include "ce/inc/trace.h"
#if CONFIG_TRACE
@@ -25,8 +24,15 @@ rxce_trace_init (rxce_t *ctx)
static const trace_event_id_t event_ids[] =
{
TRACE_EVENT (RXCE_TRACE_INIT, "RXCE_INIT", TIMESTAMP),
- TRACE_EVENT (RXCE_TRACE_PB_MEASUREMENT, "RXCE_PB_MEASUREMENT_CB", TIMESTAMP);
- };
+ TRACE_EVENT (RXCE_TRACE_SAR_MEASUREMENT_CB,"RXCE_SAR_MEASUREMENT_CB",TIMESTAMP),
+ TRACE_EVENT (RXCE_TRACE_MEASURE_DROPPED, "RXCE_MEASURE_DROPPED",TIMESTAMP),
+ TRACE_EVENT (RXCE_TRACE_PROCESS_WAIT, "RXCE_PROCESS_WAIT",TIMESTAMP),
+ TRACE_EVENT (RXCE_TRACE_PROCESS_TRIGGERED, "RXCE_PROCESS_TRIGGERED",TIMESTAMP),
+ TRACE_EVENT (RXCE_TRACE_SCF_PROCESS, "RXCE_SCF_COMPUTE",TIMESTAMP),
+ TRACE_EVENT (RXCE_TRACE_CEI_PROCESS, "RXCE_CEI_PROCESS",TIMESTAMP),
+ TRACE_EVENT (RXCE_TRACE_BITLOADING_PROCESS, "RXCE_BITLOADING_PROCESS",TIMESTAMP),
+ TRACE_EVENT (RXCE_TRACE_REFRESH_PROCESS, "RXCE_REFRESH_PROCESS",TIMESTAMP),
+ };
dbg_assert (ctx);
trace_namespace_init (&namespace, event_ids, COUNT (event_ids));
trace_buffer_add (&ctx->trace, "ce", 8, 4, true, &namespace);
diff --git a/ce/test/cov/cov_all_run.sh b/ce/test/cov/cov_all_run.sh
index 50dc3d2365..f405ec2a79 100755
--- a/ce/test/cov/cov_all_run.sh
+++ b/ce/test/cov/cov_all_run.sh
@@ -13,7 +13,7 @@ do
f) firefox=1;;
m) MAXIMUS_ARG="-x $OPTARG";;
t) test_path="$OPTARG";;
- [?]) print >&2 "Usage: $0 [-c] [-e] [-f] [-m] maximus_path"
+ [?]) print >&2 "Usage: $0 [-c] [-e] [-f] [-m maximus_path] [-t test_path] "
exit 1;;
esac
done
diff --git a/ce/test/rx/general/src/test_bitloading.c b/ce/test/rx/general/src/test_bitloading.c
index e2223dfd24..319b06ca48 100755
--- a/ce/test/rx/general/src/test_bitloading.c
+++ b/ce/test/rx/general/src/test_bitloading.c
@@ -211,9 +211,9 @@ test_date_in_beacon_atu_get (test_t t)
for (i=0; i<MAC_MS_TO_TCK(40)/2; i++)
{
uint ans = bitloading_date_in_beacon_atu_get (i, (0xFFFFFFFF)-i);
- test_fail_if (ans != MAC_TCK_TO_ATU(2*i+1));
+ test_fail_if (ans != (uint) MAC_TCK_TO_ATU(2*i+1));
ans = bitloading_date_in_beacon_atu_get (1000000-i, i);
- test_fail_if (ans != MAC_TCK_TO_ATU(1000000-2*i));
+ test_fail_if (ans != (uint) MAC_TCK_TO_ATU(1000000-2*i));
}
} test_end;
}
diff --git a/ce/test/rx/general/src/test_mpdu_measure_store.c b/ce/test/rx/general/src/test_mpdu_measure_store.c
index 4522cc2c3c..8b95e3cafd 100755
--- a/ce/test/rx/general/src/test_mpdu_measure_store.c
+++ b/ce/test/rx/general/src/test_mpdu_measure_store.c
@@ -33,11 +33,10 @@ test_alloc_release (test_t test)
}
void
-sar_fill_ber (pb_measure_blk_t *first, uint n, uint ber_init_value)
+sar_fill_ber (blk_t *first, uint n, uint ber_init_value, uint offset)
{
uint i;
u32 *wrdata = (u32 *) first->data;
- uint offset = first->pb_nb;
uint cpt = offset;
for (i=0; i<n; i++)
{
@@ -46,11 +45,9 @@ sar_fill_ber (pb_measure_blk_t *first, uint n, uint ber_init_value)
dbg_assert (first->next);
first = first->next;
wrdata = (u32 *) first->data;
- first->pb_nb = 0;
cpt=0;
}
*(wrdata+cpt) = i+ber_init_value;
- first->pb_nb++;
cpt++;
}
}
@@ -69,15 +66,17 @@ test_mpdu_measure_pb_add (test_t t, mpdu_measure_store_t *ctx)
uint N = sar_call_nb;
uint pb_nb_to_add = pb_nb_per_call;
uint n,i;
+ uint offset;
pb_measure_blk_t *first_ber =NULL;
pb_measure_blk_t *last_ber = NULL;
+
pbproc_rx_params_t *rx_params = (pbproc_rx_params_t *) blk_alloc();
- mpdu_measure_store_append (ctx, rx_params, 0, &first_ber, &last_ber, NULL, 0);
+ mpdu_measure_store_append (ctx, rx_params, 0, &first_ber, &last_ber, NULL, 0, NULL);
mpdu_measure_t *measure = mpdu_measure_store_get(ctx);
for (n=0; n<N; n++)
{
- mpdu_measure_pb_add (measure, pb_nb_to_add, &first_ber, &last_ber);
- sar_fill_ber (first_ber, pb_nb_to_add, n * pb_nb_to_add);
+ mpdu_measure_pb_add (measure, pb_nb_to_add, &first_ber, &last_ber, &offset);
+ sar_fill_ber ((blk_t *)first_ber, pb_nb_to_add, n * pb_nb_to_add, offset);
}
pb_measure_blk_t *rd = measure->pb_head;
u32 *rddata = (u32 *) rd->data;
@@ -142,7 +141,7 @@ test_mpdu_measure_chandata_add (test_t t, mpdu_measure_store_t *ctx)
{
uint i;
pbproc_rx_params_t *rx_params = (pbproc_rx_params_t *) blk_alloc();
- bool b = mpdu_measure_store_append (ctx, rx_params, 0, NULL, NULL, NULL, 0);
+ bool b = mpdu_measure_store_append (ctx, rx_params, 0, NULL, NULL, NULL, 0, NULL);
if (b)
{
mpdu_measure_t *measure = mpdu_measure_store_get(ctx);
@@ -192,7 +191,7 @@ test_mpdu_measure_add (test_t t, mpdu_measure_store_t *ctx)
pbproc_rx_params_t *rx_params = (pbproc_rx_params_t *) blk_alloc();
pb_measure_blk_t **f,**l;
f = l = NULL;
- bool b = mpdu_measure_store_append (ctx, rx_params, 0, f, l, NULL, 0);
+ bool b = mpdu_measure_store_append (ctx, rx_params, 0, f, l, NULL, 0, NULL);
if (b)
{
rx_params->preamble_ntb = nb_frame_added;
@@ -241,7 +240,7 @@ test_mpdu_measure_store_management (test_t t, mpdu_measure_store_t *ctx)
pbproc_rx_params_t *rx_params = (pbproc_rx_params_t *) blk_alloc();
pb_measure_blk_t **f,**l;
f = l = NULL;
- bool b = mpdu_measure_store_append (ctx, rx_params, 0, f, l, NULL, 0);
+ bool b = mpdu_measure_store_append (ctx, rx_params, 0, f, l, NULL, 0, NULL);
if (b)
{
rx_params->preamble_ntb = i;
@@ -252,7 +251,7 @@ test_mpdu_measure_store_management (test_t t, mpdu_measure_store_t *ctx)
pbproc_rx_params_t *rx_params = (pbproc_rx_params_t *) blk_alloc();
pb_measure_blk_t **f,**l;
f = l = NULL;
- bool b = mpdu_measure_store_append (ctx, rx_params, 0, f, l, NULL, 0);
+ bool b = mpdu_measure_store_append (ctx, rx_params, 0, f, l, NULL, 0, NULL);
test_fail_if (b);
mpdu_measure_store_release (ctx, first);
// Release all the store.
@@ -270,7 +269,7 @@ test_mpdu_measure_store_management (test_t t, mpdu_measure_store_t *ctx)
// Test store empty.
first = mpdu_measure_store_get (ctx);
test_fail_if (first);
- mpdu_measure_store_append (ctx, rx_params, 0, f, l, NULL, 0);
+ mpdu_measure_store_append (ctx, rx_params, 0, f, l, NULL, 0, NULL);
first = mpdu_measure_store_get (ctx);
test_fail_unless (first->rx_params == rx_params);
mpdu_measure_store_release (ctx, first);
diff --git a/ce/test/rx/general/src/test_rx.c b/ce/test/rx/general/src/test_rx.c
index dbd350fe17..e33ca4ec74 100755
--- a/ce/test/rx/general/src/test_rx.c
+++ b/ce/test/rx/general/src/test_rx.c
@@ -26,11 +26,13 @@
#include "mac/common/ntb.h"
#include "ce/inc/trace.h"
#include "ce/inc/bitloading.h"
+#include "mac/sar/sar.h"
lib_rnd_t rnd;
test_t test;
phy_t *phy_ctx;
rxce_t *rxce_ctx;
+sar_t *sar;
#define FRAME_PRIORITY 10
@@ -134,9 +136,9 @@ sar_noise_new (pbproc_rx_params_t *rx_params, uint noise[], uint symbol_nb)
for (i=0; i<symbol_nb; i++) *(time_data+i) = lambda;
time_noise->blk.next = (blk_t *) freq_noise;
ce_print ("\t\t\t\t ADD NOISES\n");
- sar_mpdu_measurement_cb (rxce_ctx, rx_params, 0, NULL, NULL, (pb_t *) time_noise,
+ rxce_mpdu_measurement_add (rxce_ctx, rx_params, 0, NULL, NULL, (pb_t *) time_noise,
mpdu_measure_chandata_blk_nb[PHY_CHANDATA_TYPE_NRJ] +
- mpdu_measure_chandata_blk_nb[PHY_CHANDATA_TYPE_NRJ_SYMBOL]);
+ mpdu_measure_chandata_blk_nb[PHY_CHANDATA_TYPE_NRJ_SYMBOL], NULL);
}
void
@@ -237,6 +239,7 @@ frame_process (cyg_addrword_t data)
blk_release (phy_ctx);
rxce_trace_print(rxce_ctx);
rxce_trace_uninit (rxce_ctx);
+ blk_release (sar);
trace_uninit();
test_begin (test, "check alloc/free")
{
@@ -256,7 +259,8 @@ cyg_user_start (int argc, char **argv)
mac_config_init (&mac_config);
status.mac_store_ctx = mac_store_init ();
mac_ntb_init (phy_ctx, &mac_config);
- rxce_ctx = rxce_init (status.mac_store_ctx, &mac_config);
+ sar = blk_alloc();
+ rxce_ctx = rxce_init (sar, status.mac_store_ctx, &mac_config);
over_pbproc_init ();
pbproc_rxce_init (pbproc_need_scf_cb);
diff --git a/ce/test/rx/general/src/test_sar_integration.c b/ce/test/rx/general/src/test_sar_integration.c
index de1e16bbcb..e580928cea 100755
--- a/ce/test/rx/general/src/test_sar_integration.c
+++ b/ce/test/rx/general/src/test_sar_integration.c
@@ -134,7 +134,7 @@ START (sar_t **sar_ctx, sta_t **sta, ca_t **ca)
*ca = (ca_t *) blk_alloc();
*sar_ctx = sar_init (mac_store_ctx, pbproc_ctx, *ca);
sar_init_measure_context (*sar_ctx, rxce_ctx);
- sar_init_measurement_cb (*sar_ctx, &sar_mpdu_measurement_cb);
+ sar_init_measurement_cb (*sar_ctx, &rxce_mpdu_measurement_add);
mac_store_sta_add (mac_store_ctx, 1);
*sta = mac_store_sta_get (mac_store_ctx, 1);
}
@@ -142,7 +142,6 @@ START (sar_t **sar_ctx, sta_t **sta, ca_t **ca)
void
END (sar_t *sar_ctx, sta_t *sta, ca_t *ca)
{
- //sta_uninit (sta);
//sar_trace_print (sar_ctx);
blk_release (sta); // release reference to sta added by mac_store_mfs_get in START.
dbg_check (mac_store_sta_remove (mac_store_ctx, 1));
@@ -287,7 +286,8 @@ cyg_user_start (int argc, char **argv)
tonemask_default ((u8 *)(&(mac_config.tonemask_info.tonemask)));
mac_store_ctx = mac_store_init ();
- rxce_ctx = rxce_init (mac_store_ctx, &mac_config);
+ sar_t *sar = blk_alloc();
+ rxce_ctx = rxce_init (sar, mac_store_ctx, &mac_config);
cyg_thread_create (RXCE_PRIORITY, &rxce_process,(cyg_addrword_t) rxce_ctx, "rxce",
rxce_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL,
&rxce_handle, &rxce_thread);
@@ -296,6 +296,7 @@ cyg_user_start (int argc, char **argv)
frame_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL,
&frame_handle, &frame_thread);
cyg_thread_resume (frame_handle);
+ blk_release (sar);
}
diff --git a/ce/test/rx/general/target-Makefile b/ce/test/rx/general/target-Makefile
index 954e55126c..96f9d8b9d4 100644
--- a/ce/test/rx/general/target-Makefile
+++ b/ce/test/rx/general/target-Makefile
@@ -6,10 +6,11 @@ INCLUDES += ce/test/rx/general/overide
INCLUDES += ce/test/common
ECOS = y
+DEFS=-DSAR_UNIT_TEST=1
TARGET_PROGRAMS=test_rx_target_ecos_synth
test_rx_target_ecos_synth_SOURCES = test_rx.c
-test_rx_target_ecos_synth_MODULES = lib mac/common ce ce/test/common ce/test/rx/general/overide/cp/interf
+test_rx_target_ecos_synth_MODULES = lib mac/common ce ce/test/common ce/test/rx/general/overide/cp/interf mac/sar mac/sar/test mac/pbproc mac/sar/bridgedma
TARGET_PROGRAMS += test_sar_target_ecos_synth
test_sar_target_ecos_synth_SOURCES = test_sar_integration.c
test_sar_target_ecos_synth_MODULES = lib mac/sar ce mac/common mac/sar/bridgedma mac/pbproc mac/sar/test ce/test/common ce/test/rx/general/overide/cp/interf
diff --git a/ce/test/rx/maximus/Makefile b/ce/test/rx/maximus/Makefile
index 3e64bc166e..ba5c632834 100644
--- a/ce/test/rx/maximus/Makefile
+++ b/ce/test/rx/maximus/Makefile
@@ -7,8 +7,9 @@ INCLUDES += ce/test/rx/maximus
INCLUDES += ce/test/rx/general/overide
INCLUDES += ce/test/common
ECOS = y
+DEFS=-DSAR_UNIT_TEST=1
-EXTRA_TARGET_CFLAGS=-DMAXIMUS_TEST
+EXTRA_TARGET_CFLAGS=-DMAXIMUS_TEST -DRXCE_WITH_SAR
TARGET_PROGRAMS = test_rx
test_rx_SOURCES = test_rx.c
test_rx_MODULES=lib host mac/common hal/phy/maximus mac/sar ce ce/test/rx/maximus/overide/mac/pbproc ce/test/rx/general/overide/cp/interf ce/test/common
diff --git a/ce/test/rx/maximus/src/test_rx.c b/ce/test/rx/maximus/src/test_rx.c
index 32a6544359..a6785deb5a 100644
--- a/ce/test/rx/maximus/src/test_rx.c
+++ b/ce/test/rx/maximus/src/test_rx.c
@@ -68,12 +68,6 @@ local_sar_mpdu_measurement_cb (void *user, pbproc_rx_params_t *rx_params,
void
sar_start (void)
{
- pbproc_t *pbproc_ctx = pbproc_init (&mac_config_ctx, mac_store_ctx);
- ca = blk_alloc();
- sar_ctx = sar_init (mac_store_ctx, pbproc_ctx, ca);
- sar_init_measure_context (sar_ctx, rxce_ctx);
- //sar_init_measurement_cb (sar_ctx, &local_sar_mpdu_measurement_cb);
- sar_init_measurement_cb (sar_ctx, &sar_mpdu_measurement_cb);
mac_store_sta_add (mac_store_ctx, 1);
sta = mac_store_sta_get (mac_store_ctx, 1);
cyg_thread_create (SAR_PRIORITY, &sar_process, (cyg_addrword_t)sar_ctx, "sar_test",
@@ -94,7 +88,10 @@ sar_end (void)
void
ce_init (void)
{
- rxce_ctx = rxce_init (mac_store_ctx, &mac_config_ctx);
+ pbproc_t *pbproc_ctx = pbproc_init (&mac_config_ctx, mac_store_ctx);
+ ca = blk_alloc();
+ sar_ctx = sar_init (mac_store_ctx, pbproc_ctx, ca);
+ rxce_ctx = rxce_init (sar_ctx, mac_store_ctx, &mac_config_ctx);
cyg_thread_create (RXCE_PRIORITY, &rxce_process, (cyg_addrword_t) rxce_ctx, "rxce",
rxce_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL,
&rxce_handle, &rxce_thread);
diff --git a/ce/test/rx/tonemap_refresh/Makefile b/ce/test/rx/tonemap_refresh/Makefile
index 081b333cf0..e0fe57d3b4 100644
--- a/ce/test/rx/tonemap_refresh/Makefile
+++ b/ce/test/rx/tonemap_refresh/Makefile
@@ -7,7 +7,7 @@ INCLUDES += ce/test/common
ECOS = y
-EXTRA_TARGET_CFLAGS=-DEXPIRATION_TEST
+EXTRA_TARGET_CFLAGS=-DEXPIRATION_TEST
TARGET_PROGRAMS=test_tonemaps_refresh_target_ecos_synth
test_tonemaps_refresh_target_ecos_synth_SOURCES = test_tonemaps_refresh.c
test_tonemaps_refresh_target_ecos_synth_MODULES = lib mac/common ce ce/test/common ce/test/rx/general/overide/cp/interf
diff --git a/ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c b/ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c
index 1258b8a80c..d6a7e2d296 100644
--- a/ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c
+++ b/ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c
@@ -49,7 +49,6 @@ test_expiration_cb (int dtei)
{
cyg_tick_count_t current = cyg_current_time ();
sta_t *lsta = mac_store_sta_get (mac_store_ctx, dtei);
- ce_print ("create cei for sta[%d] @%llu, previous @%llu, diff=%llu\n",dtei, current, date[dtei], current - date[dtei]);
test_begin (test, "Check date of cei creation\n")
{
test_fail_if (current > date[dtei] + S_TO_RTC (TONEMAPS_LIFE_DURATION_S));
@@ -89,7 +88,7 @@ cyg_user_start (int argc, char **argv)
trace_init();
lib_rnd_init (&rnd, 123);
mac_store_ctx = mac_store_init ();
- rxce_ctx = rxce_init (mac_store_ctx, &mac_config);
+ rxce_ctx = rxce_init (NULL, mac_store_ctx, &mac_config);
rxce_init_test_cb (&test_expiration_cb);
for (i=1; i<= 250; i++)
{
@@ -115,6 +114,4 @@ cyg_user_start (int argc, char **argv)
cpu_load_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL,
&cpu_load_handle, &cpu_load_thread);
cyg_thread_resume (cpu_load_handle);
-
-
}
diff --git a/mac/sar/inc/trace.h b/mac/sar/inc/trace.h
index 4fc8b8e5e2..20b7a60e96 100644
--- a/mac/sar/inc/trace.h
+++ b/mac/sar/inc/trace.h
@@ -15,6 +15,7 @@
*/
#include "lib/trace.h"
+#include "mac/sar/sar.h"
/** Shortcut for tracing inside SAR. */
#define SAR_TRACE(id, args...) \