summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
Diffstat (limited to 'cesar')
-rw-r--r--cesar/bsu/ntb/src/ntb.c11
-rw-r--r--cesar/bsu/src/bsu.c6
-rw-r--r--cesar/bsu/test/utest/src/bsut.c4
-rw-r--r--cesar/bsu/test/utest/src/schedules.c9
4 files changed, 26 insertions, 4 deletions
diff --git a/cesar/bsu/ntb/src/ntb.c b/cesar/bsu/ntb/src/ntb.c
index 96b8a7097c..a64f70ce5b 100644
--- a/cesar/bsu/ntb/src/ntb.c
+++ b/cesar/bsu/ntb/src/ntb.c
@@ -14,7 +14,6 @@
#include "lib/fixed.h"
#include "bsu/ntb/ntb.h"
#include "mac/common/timings.h"
-#include <string.h>
/** Define a security level for frequency error.
* If frequency error is greater then re-initialise freq error. */
@@ -94,7 +93,15 @@ void
bsu_ntb_init (bsu_ntb_sync_t *ctx)
{
dbg_assert (ctx);
- memset (ctx, 0, sizeof (bsu_ntb_sync_t));
+ ctx->init = false;
+ ctx->second_shoot = false;
+ ctx->fe = 0.0;
+ ctx->bts = 0;
+ ctx->preamble_sysdate = 0;
+ ctx->preamble_stadate = 0;
+ ctx->sta_numerator = 0;
+ ctx->ntb_offset_tck = 0;
+ ctx->delay_systck = 0;
}
void
diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c
index 64c0448f33..01e84addf1 100644
--- a/cesar/bsu/src/bsu.c
+++ b/cesar/bsu/src/bsu.c
@@ -119,6 +119,7 @@ bsu_avln_add (bsu_t *ctx, u64 nid, u8 snid, bool *added)
if (!avln && ctx->avlns_nb < BSU_FOREIGN_AVLNS_NB)
{
avln = &ctx->avlns[ctx->avlns_nb];
+ bsu_ntb_init (&avln->sync);
avln->beacon.vf.nid = nid;
avln->snid = snid;
avln->beacon.beacon_period_start_date = phy_date ();
@@ -734,11 +735,14 @@ bsu_init (bsu_aclf_t *aclf, mac_config_t *mac_config, phy_t *phy,
uint i;
for (i = 0; i < HPAV_AVLNS_NB_MAX; i++)
{
- memset (&ctx->avlns[i].beacon, 0, sizeof (bsu_beacon_t));
+ memset (&ctx->avlns[i], 0, sizeof (bsu_avln_t));
ctx->avlns[i].beacon.vf.nm = BSU_BEACON_NM_CSMA_ONLY;
bsu_ntb_init (&ctx->avlns[i].sync);
}
ctx->sta_avln = &ctx->poweron;
+ memset (&ctx->poweron, 0, sizeof (bsu_avln_t));
+ ctx->poweron.beacon.vf.nm = BSU_BEACON_NM_CSMA_ONLY;
+ bsu_ntb_init (&ctx->poweron.sync);
/* Initialise the SAR callback. */
sar_init_beacon_cb (sar, ctx, (sar_beacon_cb_t) bsu_beacon_recv);
/* Initialise timer events. */
diff --git a/cesar/bsu/test/utest/src/bsut.c b/cesar/bsu/test/utest/src/bsut.c
index 3f5e0991f4..190a776aff 100644
--- a/cesar/bsu/test/utest/src/bsut.c
+++ b/cesar/bsu/test/utest/src/bsut.c
@@ -152,6 +152,7 @@ test_case_bsu_process (test_t test)
brx.snid = 0x2;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL, &t.mac_config,
&btx);
+ b->phy_pb.pb_rx.pb_measurement.crc_error = false;
t.bsu->sta_avln->beacon.beacon_period_start_date =
phy_date () - BSU_ACLF_BP_50HZ_TCK - 1000;
bsu_beacon_t *bbeacon = bsu_beacon_process (t.bsu, b, &brx);
@@ -195,6 +196,7 @@ test_case_bsu_process (test_t test)
brx.snid = 0x3;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_DISCOVER,
&t.mac_config, &btx);
+ b->phy_pb.pb_rx.pb_measurement.crc_error = false;
t.bsu->sta_avln->beacon.beacon_period_start_date =
phy_date () - BSU_ACLF_BP_50HZ_TCK - 1000;
bsu_beacon_t *bprocessed = bsu_beacon_process (t.bsu, b, &brx);
@@ -205,6 +207,7 @@ test_case_bsu_process (test_t test)
blk_release (bprocessed);
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL,
&t.mac_config, &btx);
+ b->phy_pb.pb_rx.pb_measurement.crc_error = false;
bprocessed = bsu_beacon_process (t.bsu, b, &brx);
test_fail_unless (bprocessed);
avln = bsu_avln_get (t.bsu, beacon.vf.nid, brx.snid);
@@ -271,6 +274,7 @@ test_case_bsu_process_sta_is_cco (test_t test)
brx.snid = 0x2;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL, &t.mac_config,
&btx);
+ b->phy_pb.pb_rx.pb_measurement.crc_error = false;
bsu_beacon_t *bbeacon = bsu_beacon_process (t.bsu, b, &brx);
test_fail_unless (t.bsu->beacon_nb_recv [BSU_BEACON_TYPE_CENTRAL]
== 1);
diff --git a/cesar/bsu/test/utest/src/schedules.c b/cesar/bsu/test/utest/src/schedules.c
index 7a9da78ac9..3436936b25 100644
--- a/cesar/bsu/test/utest/src/schedules.c
+++ b/cesar/bsu/test/utest/src/schedules.c
@@ -205,11 +205,18 @@ test_case_bsu_schedules_countdowns (test_t t)
{
beacon.bmis.bpsto.bpsto = 0;
pb_beacon_t *b = bsu_beacon_write (
- &beacon, BSU_BEACON_TYPE_CENTRAL, &ctx.mac_config, &bparams);
+ &beacon, BSU_BEACON_TYPE_CENTRAL, &ctx.mac_config,
+ &bparams);
((pb_t *) b)->phy_pb.pb_rx.pb_measurement.crc_error = false;
+ bparamsrx.access = HPAV_ACCESS_IN_HOME;
+ bparamsrx.snid = ctx.bsu->sta_avln->snid;
bparamsrx.preamble_date =
bparamsrx.bts = ctx.bsu->aclf->bpsd[1];
bparamsrx.preamble_sysdate = phy_sysdate ();
+ for (j = 0; j < COUNT (bparamsrx.bto); j++)
+ bparamsrx.bto[j] = 0;
+ ctx.bsu->sta_avln->sync.bts = bparamsrx.bts -
+ BSU_ACLF_BP_50HZ_TCK;
/* On beacon reception only schedules are read and CA is
* programmed with the current data. */
bsu_beacon_recv (ctx.bsu, b, &bparamsrx);