summaryrefslogtreecommitdiff
path: root/cesar/bsu/aclf
diff options
context:
space:
mode:
authorNélio Laranjeiro2010-09-13 16:00:46 +0200
committerNélio Laranjeiro2010-09-16 16:58:31 +0200
commitd080b1117d9a2e4f7dea1391c218dd65ead6eac3 (patch)
tree89417e8971696776167479d8556fb76421edc09a /cesar/bsu/aclf
parent7cc377484329bca6309de17c846434508309a2b8 (diff)
cesar/bsu/aclf: fix bts computation, closes #1876
See specification section 5.1.1.1 Line Cycle Synchronization.
Diffstat (limited to 'cesar/bsu/aclf')
-rw-r--r--cesar/bsu/aclf/src/aclf.c6
-rw-r--r--cesar/bsu/aclf/test/utest/src/bpsd.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/cesar/bsu/aclf/src/aclf.c b/cesar/bsu/aclf/src/aclf.c
index ad6de93d76..4816c043de 100644
--- a/cesar/bsu/aclf/src/aclf.c
+++ b/cesar/bsu/aclf/src/aclf.c
@@ -114,7 +114,7 @@ bsu_aclf_ac_compute_beacon_period_start_date (bsu_aclf_t *ctx)
bts = ctx->bpsd[1];
for (i = 0; i < HPAV_BEACON_BTO_NB; i++)
{
- bto = ctx->bpsd[i+2] - bts - (i+1)*ctx->bp;
+ bto = ctx->bpsd[i+2] - ctx->bpsd[i+1] - ctx->bp;
/* Does bto overflowed ? */
if (ABS(bto) >> 15 == 0)
ctx->bto[i] = bto;
@@ -233,11 +233,11 @@ bsu_aclf_compute_beacon_period_start_date (bsu_aclf_t *ctx, const u32 bts_ntb,
ctx->bto[i] = bto[i];
/* BTO is valid use it to compute. */
if (bto[i] != HPAV_BEACON_BTO_INVALID)
- ctx->bpsd[i+1] = bts_date + (i+1)*ctx->bp + bto[i];
+ ctx->bpsd[i+1] = ctx->bpsd[i] + ctx->bp + bto[i];
/* BTO is not valid, STA assumes the beacon period start date has
* no offset (FIXME: Good idea ?) */
else
- ctx->bpsd[i+1] = bts_date + (i+1)*ctx->bp;
+ ctx->bpsd[i+1] = ctx->bpsd[i] + ctx->bp;
}
else
ctx->bpsd[i+1] = ctx->bpsd[i] + ctx->bp;
diff --git a/cesar/bsu/aclf/test/utest/src/bpsd.c b/cesar/bsu/aclf/test/utest/src/bpsd.c
index efcebf8959..476b8881e7 100644
--- a/cesar/bsu/aclf/test/utest/src/bpsd.c
+++ b/cesar/bsu/aclf/test/utest/src/bpsd.c
@@ -181,10 +181,10 @@ test_case_aclf_compute_bto (test_t t)
for (j = 0; j < HPAV_BEACON_BTO_NB; j++)
{
- bto = bpsd_cco[j+2] - bts - (j+1)*test_cco.aclf->bp;
+ bto = bpsd_cco[j+2] - bpsd_cco[j+1] - test_cco.aclf->bp;
if (ABS(bto) >> 15 == 0)
{
- test_fail_unless (bts + (j+1) * test_cco.aclf->bp
+ test_fail_unless (bpsd_cco[j+1] + test_cco.aclf->bp
+ btos_cco[j] == bpsd_cco[2+j]);
}
else