summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYacine Belkadi2013-05-29 13:53:58 +0200
committerYacine Belkadi2013-06-06 15:49:10 +0200
commitd19cee4d2bf180a7c6345a70df1e39a36dce619d (patch)
tree255dda71c43c67c6e5241ebfd7afcb7fde681ae3
parentde638d4bf01467f57410317c7bfa0b5aae9adb34 (diff)
cesar/{cp/{av,}/beacon,mac/pbproc}: add pbproc_spoc_reset(), refs #4004
Add a pbproc_spoc_reset() that the cp can use to reset SPOC parameters, without having to know what the reset parameters are. This allows to move the knowledge of reset values to the pbproc, and will help for next commits. Refactoring only. No (intended) functional changes.
-rw-r--r--cesar/cp/av/beacon/test/utest/src/stubs.c4
-rw-r--r--cesar/cp/av/beacon/test/utest2/src/pbproc_stub.c5
-rw-r--r--cesar/cp/beacon/src/beacon.c2
-rw-r--r--cesar/mac/pbproc/pbproc.h7
-rw-r--r--cesar/mac/pbproc/src/pbproc.c16
5 files changed, 31 insertions, 3 deletions
diff --git a/cesar/cp/av/beacon/test/utest/src/stubs.c b/cesar/cp/av/beacon/test/utest/src/stubs.c
index bfe045ed8f..558896f4a3 100644
--- a/cesar/cp/av/beacon/test/utest/src/stubs.c
+++ b/cesar/cp/av/beacon/test/utest/src/stubs.c
@@ -97,3 +97,7 @@ pbproc_spoc_update (pbproc_t *pbproc, bool sync, s32 rho_q30)
{
}
+void
+pbproc_spoc_reset (pbproc_t *pbproc)
+{
+}
diff --git a/cesar/cp/av/beacon/test/utest2/src/pbproc_stub.c b/cesar/cp/av/beacon/test/utest2/src/pbproc_stub.c
index 51c4195a98..5e049a5f4b 100644
--- a/cesar/cp/av/beacon/test/utest2/src/pbproc_stub.c
+++ b/cesar/cp/av/beacon/test/utest2/src/pbproc_stub.c
@@ -19,3 +19,8 @@ void
pbproc_spoc_update (pbproc_t *pbproc, bool sync, s32 rho_q30)
{
}
+
+void
+pbproc_spoc_reset (pbproc_t *pbproc)
+{
+}
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index 7c9cd4a55d..65dddc6afc 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -896,7 +896,7 @@ cp_beacon_process_untracked_avln (cp_t *ctx)
/* Reset SPOC. */
ctx->beacon.spoc_updated = false;
if (ctx->beacon.spoc_update_interval_ms != 0)
- pbproc_spoc_update (ctx->pbproc, false, 0);
+ pbproc_spoc_reset (ctx->pbproc);
/* Inform BSU. */
bsu_untrack_avln (ctx->bsu);
}
diff --git a/cesar/mac/pbproc/pbproc.h b/cesar/mac/pbproc/pbproc.h
index 12d11a3372..b9c7fc6009 100644
--- a/cesar/mac/pbproc/pbproc.h
+++ b/cesar/mac/pbproc/pbproc.h
@@ -289,6 +289,13 @@ pbproc_set_chandata_conf (pbproc_t *ctx, phy_chandata_conf_t *conf, uint nb,
bool data);
/**
+ * Reset SPOC parameters, when possible.
+ * \param ctx pbproc context
+ */
+void
+pbproc_spoc_reset (pbproc_t *ctx);
+
+/**
* Update SPOC with new parameters, when possible.
* \param ctx pbproc context
* \param sync whether frequency error is synchronised
diff --git a/cesar/mac/pbproc/src/pbproc.c b/cesar/mac/pbproc/src/pbproc.c
index 58cb68732d..8769b2ce0a 100644
--- a/cesar/mac/pbproc/src/pbproc.c
+++ b/cesar/mac/pbproc/src/pbproc.c
@@ -403,8 +403,8 @@ pbproc_set_chandata_conf (pbproc_t *ctx, phy_chandata_conf_t *conf, uint nb,
ctx->chandata_data = data;
}
-void
-pbproc_spoc_update (pbproc_t *ctx, bool sync, s32 rho_q30)
+static void
+pbproc_spoc_update_ (pbproc_t *ctx, bool sync, s32 rho_q30)
{
dbg_assert (ctx);
phy_spoc_coeff_t *coeff = blk_alloc ();
@@ -425,6 +425,18 @@ pbproc_spoc_update (pbproc_t *ctx, bool sync, s32 rho_q30)
arch_isr_unlock (flags);
}
+void
+pbproc_spoc_reset (pbproc_t *ctx)
+{
+ pbproc_spoc_update_ (ctx, false, 0);
+}
+
+void
+pbproc_spoc_update (pbproc_t *ctx, bool sync, s32 rho_q30)
+{
+ pbproc_spoc_update_ (ctx, sync, rho_q30);
+}
+
static bool
pbproc_spoc_update_cb (void *user)
{