summaryrefslogtreecommitdiff
path: root/cesar/bsu/aclf
diff options
context:
space:
mode:
authorlaranjeiro2010-06-22 13:07:21 +0000
committerlaranjeiro2010-06-22 13:07:21 +0000
commit30bc47ef4c95e40fd3543359f7b3f5a1d9535629 (patch)
treebf1e479979c71864dac561efcf5b978145cfec3d /cesar/bsu/aclf
parent33b9670d73c2b0c378f767e2f1dfee6bb0fa719d (diff)
cesar/bsu/aclf: add a function to clear computed data
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7249 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/bsu/aclf')
-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);
+ }
}