summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
Diffstat (limited to 'cesar')
-rw-r--r--cesar/bsu/aclf/src/aclf.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/cesar/bsu/aclf/src/aclf.c b/cesar/bsu/aclf/src/aclf.c
index 6a3119129f..ad6de93d76 100644
--- a/cesar/bsu/aclf/src/aclf.c
+++ b/cesar/bsu/aclf/src/aclf.c
@@ -179,6 +179,23 @@ bsu_aclf_acl_frequency_detection (bsu_aclf_t *ctx)
ctx->date = newzc;
}
+/**
+ * Clear all data in BSU ACLF.
+ * \param ctx the module context.
+ */
+static void
+bsu_aclf_clear (bsu_aclf_t *ctx)
+{
+ uint i;
+ for (i = 0; i < COUNT (ctx->bpsd); i++)
+ ctx->bpsd[i] = 0;
+ ctx->beacon_period = ctx->bp;
+ for (i = 0; i < COUNT (ctx->bto); i++)
+ ctx->bto[i] = 0;
+ ctx->date = 0;
+ ctx->aclsc = false;
+}
+
bsu_aclf_t*
bsu_aclf_init (phy_t *phy, mac_config_t *mac_config, hal_timer_t *timer)
{
@@ -197,6 +214,7 @@ void
bsu_aclf_uninit (bsu_aclf_t *ctx)
{
dbg_assert (ctx);
+ bsu_aclf_clear (ctx);
}
void
@@ -257,5 +275,8 @@ bsu_aclf_activate (bsu_aclf_t *ctx, bool status)
hal_timer_instance_program (ctx->hal_timer, &ctx->timer, ctx->bpsd[1]);
}
else
+ {
hal_timer_instance_cancel (ctx->hal_timer, &ctx->timer);
+ bsu_aclf_clear (ctx);
+ }
}