summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYacine Belkadi2013-05-29 13:21:06 +0200
committerYacine Belkadi2013-06-06 15:49:09 +0200
commitde638d4bf01467f57410317c7bfa0b5aae9adb34 (patch)
treee25af8a962309c43d84c8cc572ce5cf957dbe46e
parentcb525fabeeee3a53ed47865580712b4adabe4f2b (diff)
cesar/{cp/{av,}/beacon,mac/pbproc}: add/use pbproc_spoc_update(), refs #4004
Add a pbproc_spoc_update() that the cp can use to update SPOC parameters without having to know about implementation details like allocating coefficients, computing them, then setting them. These changes will help for next commits. No (intended) functional changes.
-rw-r--r--cesar/cp/av/beacon/test/utest/src/stubs.c6
-rw-r--r--cesar/cp/av/beacon/test/utest2/src/pbproc_stub.c6
-rw-r--r--cesar/cp/av/beacon/test/utest2/src/phy_stub.c6
-rw-r--r--cesar/cp/beacon/beacon.h9
-rw-r--r--cesar/cp/beacon/src/beacon.c17
-rw-r--r--cesar/cp/beacon/stub/src/beacon.c6
-rw-r--r--cesar/mac/pbproc/pbproc.h7
-rw-r--r--cesar/mac/pbproc/src/pbproc.c7
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/phy.c7
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/tx_data.c6
10 files changed, 22 insertions, 55 deletions
diff --git a/cesar/cp/av/beacon/test/utest/src/stubs.c b/cesar/cp/av/beacon/test/utest/src/stubs.c
index 1f69e97985..bfe045ed8f 100644
--- a/cesar/cp/av/beacon/test/utest/src/stubs.c
+++ b/cesar/cp/av/beacon/test/utest/src/stubs.c
@@ -93,11 +93,7 @@ phy_date ()
}
void
-pbproc_spoc_coeff_set (pbproc_t *pbproc, bool sync, phy_spoc_coeff_t *coeff)
+pbproc_spoc_update (pbproc_t *pbproc, bool sync, s32 rho_q30)
{
- dbg_assert (coeff);
-
- blk_release (coeff->part2);
- blk_release (coeff);
}
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 be80d1b9c0..51c4195a98 100644
--- a/cesar/cp/av/beacon/test/utest2/src/pbproc_stub.c
+++ b/cesar/cp/av/beacon/test/utest2/src/pbproc_stub.c
@@ -16,10 +16,6 @@
#include "mac/pbproc/pbproc.h"
void
-pbproc_spoc_coeff_set (pbproc_t *pbproc, bool sync, phy_spoc_coeff_t *coeff)
+pbproc_spoc_update (pbproc_t *pbproc, bool sync, s32 rho_q30)
{
- dbg_assert (coeff);
-
- blk_release (coeff->part2);
- blk_release (coeff);
}
diff --git a/cesar/cp/av/beacon/test/utest2/src/phy_stub.c b/cesar/cp/av/beacon/test/utest2/src/phy_stub.c
index 6c1f58401b..c02ce25474 100644
--- a/cesar/cp/av/beacon/test/utest2/src/phy_stub.c
+++ b/cesar/cp/av/beacon/test/utest2/src/phy_stub.c
@@ -15,7 +15,6 @@
#include "common/std.h"
#include "hal/phy/phy.h"
#include "bsu/aclf/aclf.h"
-#include "hal/phy/spoc/spoc.h"
u32
phy_clock_get_zero_cross_captured_date (phy_t *phy)
@@ -28,8 +27,3 @@ phy_date ()
{
return BSU_ACLF_BP_60HZ_TCK+1;
}
-
-void
-phy_spoc_compute_all (s32 rho_q30, phy_spoc_coeff_t *coeff)
-{
-}
diff --git a/cesar/cp/beacon/beacon.h b/cesar/cp/beacon/beacon.h
index 7c765e78e6..20ddd32f3e 100644
--- a/cesar/cp/beacon/beacon.h
+++ b/cesar/cp/beacon/beacon.h
@@ -189,15 +189,6 @@ cp_beacon_update_sta_peer (cp_t *ctx, bsu_beacon_t *beacon, cp_net_t *net,
mac_t mac);
/**
- * Call computation function to compute SPOC coefficients.
- * \param ctx the module context.
- * \param sync the sync status.
- * \param fe the frequency error.
- */
-void
-cp_beacon_clk_sync_call_spoc (cp_t *ctx, bool sync, u32 fe_q30);
-
-/**
* Add the allocation of the beacon to the bandwidth manager.
* \param ctx the Module context.
* \param beacon the beacon received.
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index 2b9b051cb5..7c9cd4a55d 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -95,17 +95,6 @@ cp_beacon_fill_discover_info (
discover->present = true;
}
-
-void
-cp_beacon_clk_sync_call_spoc (cp_t *ctx, bool sync, u32 fe_q30)
-{
- dbg_assert (ctx);
- phy_spoc_coeff_t *coeff = blk_alloc ();
- coeff->part2 = blk_alloc();
- phy_spoc_compute_all (fe_q30, coeff);
- pbproc_spoc_coeff_set (ctx->pbproc, sync, coeff);
-}
-
void
cp_beacon_fill (cp_t *ctx, bsu_beacon_t *beacon)
{
@@ -702,8 +691,8 @@ cp_beacon_process_beacon_central (
&& less_mod2p32 (
ctx->beacon.spoc_update_date, phy_date ()))
{
- cp_beacon_clk_sync_call_spoc (
- ctx, true, beacon->params.frequency_error);
+ pbproc_spoc_update (ctx->pbproc, true,
+ beacon->params.frequency_error);
ctx->beacon.spoc_update_date = phy_date ()
+ MAC_MS_TO_TCK (ctx->beacon.spoc_update_interval_ms);
ctx->beacon.spoc_updated = true;
@@ -907,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)
- cp_beacon_clk_sync_call_spoc (ctx, false, 0);
+ pbproc_spoc_update (ctx->pbproc, false, 0);
/* Inform BSU. */
bsu_untrack_avln (ctx->bsu);
}
diff --git a/cesar/cp/beacon/stub/src/beacon.c b/cesar/cp/beacon/stub/src/beacon.c
index f73720b875..3470bcb15e 100644
--- a/cesar/cp/beacon/stub/src/beacon.c
+++ b/cesar/cp/beacon/stub/src/beacon.c
@@ -124,12 +124,6 @@ cp_beacon_update_sta_peer (cp_t *ctx, bsu_beacon_t *beacon, cp_net_t *net,
{ return NULL; }
void
-cp_beacon_clk_sync_call_spoc (cp_t *ctx, bool sync, u32 fe_q30)
- __attribute__ ((weak));
-void
-cp_beacon_clk_sync_call_spoc (cp_t *ctx, bool sync, u32 fe_q30) {}
-
-void
cp_beacon_sta_compute_schedules (cp_t *ctx, bsu_beacon_t *beacon)
__attribute__ ((weak));
void
diff --git a/cesar/mac/pbproc/pbproc.h b/cesar/mac/pbproc/pbproc.h
index 48fa3d2543..12d11a3372 100644
--- a/cesar/mac/pbproc/pbproc.h
+++ b/cesar/mac/pbproc/pbproc.h
@@ -289,14 +289,13 @@ pbproc_set_chandata_conf (pbproc_t *ctx, phy_chandata_conf_t *conf, uint nb,
bool data);
/**
- * Set the coefficients of SPOC in SPOC registers when possible, also set
- * delta used.
+ * Update SPOC with new parameters, when possible.
* \param ctx pbproc context
* \param sync whether frequency error is synchronised
- * \param coeff the SPOC coefficients
+ * \param rho_q30 frequency error, Q30 format
*/
void
-pbproc_spoc_coeff_set (pbproc_t *ctx, bool sync, phy_spoc_coeff_t *coeff);
+pbproc_spoc_update (pbproc_t *ctx, bool sync, s32 rho_q30);
/**
* Extract the last segment from an MFS in order to segment more data.
diff --git a/cesar/mac/pbproc/src/pbproc.c b/cesar/mac/pbproc/src/pbproc.c
index df2b1df00e..58cb68732d 100644
--- a/cesar/mac/pbproc/src/pbproc.c
+++ b/cesar/mac/pbproc/src/pbproc.c
@@ -404,10 +404,13 @@ pbproc_set_chandata_conf (pbproc_t *ctx, phy_chandata_conf_t *conf, uint nb,
}
void
-pbproc_spoc_coeff_set (pbproc_t *ctx, bool sync, phy_spoc_coeff_t *coeff)
+pbproc_spoc_update (pbproc_t *ctx, bool sync, s32 rho_q30)
{
dbg_assert (ctx);
- dbg_assert (coeff);
+ phy_spoc_coeff_t *coeff = blk_alloc ();
+ coeff->part2 = blk_alloc ();
+ phy_spoc_compute_all (rho_q30, coeff);
+
PBPROC_TRACE (SPOC_COEFF_SET, sync, coeff->rho_q30);
/* Update pending SPOC coefficients. */
uint flags = arch_isr_lock ();
diff --git a/cesar/mac/pbproc/test/pbproc/src/phy.c b/cesar/mac/pbproc/test/pbproc/src/phy.c
index 4a0de08755..1b687efadf 100644
--- a/cesar/mac/pbproc/test/pbproc/src/phy.c
+++ b/cesar/mac/pbproc/test/pbproc/src/phy.c
@@ -377,3 +377,10 @@ phy_rx_agc_gain (phy_t *ctx)
{
return 0;
}
+
+void
+phy_spoc_compute_all (s32 rho_q30, phy_spoc_coeff_t *coeff)
+{
+ dbg_assert (coeff);
+ coeff->rho_q30 = rho_q30;
+}
diff --git a/cesar/mac/pbproc/test/pbproc/src/tx_data.c b/cesar/mac/pbproc/test/pbproc/src/tx_data.c
index 51e29e70ec..9dd660e4c5 100644
--- a/cesar/mac/pbproc/test/pbproc/src/tx_data.c
+++ b/cesar/mac/pbproc/test/pbproc/src/tx_data.c
@@ -790,10 +790,8 @@ tx_data_spoc_test_case (test_t t)
test_pbproc_t tp;
test_case_begin (t, "spoc");
test_pbproc_init (&tp);
- phy_spoc_coeff_t *coeff = blk_alloc ();
- coeff->part2 = blk_alloc ();
- coeff->rho_q30 = 42;
- pbproc_spoc_coeff_set (tp.pbproc, true, coeff);
+ s32 rho_q30 = 42;
+ pbproc_spoc_update (tp.pbproc, true, rho_q30);
test_begin (t, "preamble")
{
tx_data_spoc_test (t, &tp, PHY_PREPARE_TYPE_PREAMBLE);