summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cesar/bsu/aclf/aclf.h6
-rw-r--r--cesar/bsu/aclf/src/aclf.c11
-rw-r--r--cesar/bsu/aclf/test/utest/src/bpsd.c2
3 files changed, 13 insertions, 6 deletions
diff --git a/cesar/bsu/aclf/aclf.h b/cesar/bsu/aclf/aclf.h
index abf8a26113..5b0319c29c 100644
--- a/cesar/bsu/aclf/aclf.h
+++ b/cesar/bsu/aclf/aclf.h
@@ -100,6 +100,8 @@ struct bsu_aclf_t
hal_timer_t *hal_timer;
/** Timer instance. */
hal_timer_instance_t timer;
+ /** Activated status. */
+ bool activate;
};
typedef struct bsu_aclf_t bsu_aclf_t;
@@ -129,11 +131,13 @@ bsu_aclf_uninit (bsu_aclf_t *ctx);
* \param bts_ntb the beacon time stamp in CCo's 25Mhz clock.
* \param bto the four BTO present in the beacon.
* \param bpsto the beacon period start time offset.
+ * \param ntb_offset_tck the NTB tick offset.
*/
void
bsu_aclf_compute_beacon_period_start_date (bsu_aclf_t *ctx, const u32 bts_ntb,
const s16 bto[HPAV_BEACON_BTO_NB],
- const u32 bpsto);
+ const u32 bpsto,
+ u32 ntb_offset_tck);
/**
* Get the beacon period start time.
diff --git a/cesar/bsu/aclf/src/aclf.c b/cesar/bsu/aclf/src/aclf.c
index ebf9e7274c..8ba4cc1317 100644
--- a/cesar/bsu/aclf/src/aclf.c
+++ b/cesar/bsu/aclf/src/aclf.c
@@ -72,7 +72,9 @@ bsu_aclf_shift_beacon_period_start_date (bsu_aclf_t *ctx)
{
for (i = 0; i < BSU_ACLF_BPSD_NB - 1; i++)
ctx->bpsd[i] = ctx->bpsd[i+1];
- ctx->bpsd[i] += ctx->beacon_period;
+ ctx->bpsd[i] +=
+ ctx->bpsd[BSU_ACLF_BPSD_NB-1] - ctx->bpsd[BSU_ACLF_BPSD_NB-2];
+ ctx->beacon_period = ctx->bpsd[1] - ctx->bpsd[0];
}
}
@@ -200,12 +202,11 @@ bsu_aclf_uninit (bsu_aclf_t *ctx)
void
bsu_aclf_compute_beacon_period_start_date (bsu_aclf_t *ctx, const u32 bts_ntb,
const s16 bto[HPAV_BEACON_BTO_NB],
- const u32 bpsto)
+ const u32 bpsto, u32 ntb_offset_tck)
{
uint i;
dbg_assert (ctx);
-
- u32 bts_date = bts_ntb - ctx->mac_config->ntb_offset_tck;
+ u32 bts_date = bts_ntb - ntb_offset_tck - bpsto;
ctx->bpsd[0] = bts_date;
for (i = 0; i < HPAV_BEACON_BTO_NB; i++)
{
@@ -242,6 +243,8 @@ void
bsu_aclf_activate (bsu_aclf_t *ctx, bool status)
{
dbg_assert (ctx);
+ dbg_assert (ctx->activate != status);
+ ctx->activate = status;
if (status)
{
bsu_aclf_acl_frequency_detection (ctx);
diff --git a/cesar/bsu/aclf/test/utest/src/bpsd.c b/cesar/bsu/aclf/test/utest/src/bpsd.c
index 26dffb5fdc..808556ce03 100644
--- a/cesar/bsu/aclf/test/utest/src/bpsd.c
+++ b/cesar/bsu/aclf/test/utest/src/bpsd.c
@@ -162,7 +162,7 @@ test_case_aclf_compute_bto (test_t t)
* BTOs of the central beacon. */
bts = bpsd_cco[1];
bsu_aclf_compute_beacon_period_start_date (test_sta.aclf, bts,
- btos_cco, 0);
+ btos_cco, 0, 0);
bsu_aclf_bto (test_sta.aclf, btos_sta, bto_nb);
bsu_aclf_beacon_period_start_date (test_sta.aclf, bpsd_sta,
bpsd_nb);