summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaranjeiro2010-07-22 08:40:47 +0000
committerlaranjeiro2010-07-22 08:40:47 +0000
commit73fa83307eeeb09ec5f962c22d428c178e419d0a (patch)
treec90906dade346c1a16281fd3bf0f15ae9a8da179
parentdf052ada107010e544918a6319db94762ea08476 (diff)
cesar/bsu: persistent schedule
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7307 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/bsu/beacon/defs.h5
-rw-r--r--cesar/bsu/src/bsu.c13
-rw-r--r--cesar/bsu/test/utest/src/schedules.c2
3 files changed, 10 insertions, 10 deletions
diff --git a/cesar/bsu/beacon/defs.h b/cesar/bsu/beacon/defs.h
index 8737b4bb94..9bed84eeac 100644
--- a/cesar/bsu/beacon/defs.h
+++ b/cesar/bsu/beacon/defs.h
@@ -162,4 +162,9 @@ typedef enum bsu_beacon_entry_header_t bsu_beacon_entry_header_t;
/** Define the infinite permanent schedule. */
#define BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN 7
+/** Check if the allocation is permanent. */
+#define BSU_BEACON_PERSISTENT_ALLOC_IS_PERMANENT(s) \
+ (s.pscd == 0 \
+ && s.cscd == BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN)
+
#endif /* bsu_beacon_inc_bmi_defs_h */
diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c
index 4d50851377..318e3899a2 100644
--- a/cesar/bsu/src/bsu.c
+++ b/cesar/bsu/src/bsu.c
@@ -160,9 +160,7 @@ bsu_schedules_merge_process_init (bsu_t *ctx, bsu_beacon_schedules_t *sched,
if ((sched->ps.ps[i].pscd <= beacon_period_index
&& (u32) (sched->ps.ps[i].pscd + sched->ps.ps[i].cscd)
>= beacon_period_index)
- || (sched->ps.ps[i].pscd == 0
- && sched->ps.ps[i].cscd ==
- BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN))
+ || BSU_BEACON_PERSISTENT_ALLOC_IS_PERMANENT(sched->ps.ps[i]))
{
proc->ps = &sched->ps.ps[i];
proc->ps_alloc_index = 0;
@@ -327,16 +325,13 @@ bsu_ca_schedules_nm_csma_only (bsu_t *ctx, bsu_beacon_schedules_t *schedule)
{
if (schedule->ps.nb == 0
|| !(schedule->ps.nb == 1
- && schedule->ps.ps[0].pscd ==
- BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN
- && schedule->ps.ps[0].cscd ==
- BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN))
+ && BSU_BEACON_PERSISTENT_ALLOC_IS_PERMANENT(
+ schedule->ps.ps[0])))
{
schedule->nps.ns = 0;
schedule->ps.nb = 1;
schedule->ps.ps[0].ns = 1;
- schedule->ps.ps[0].pscd =
- BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN;
+ schedule->ps.ps[0].pscd = 0;
schedule->ps.ps[0].cscd =
BSU_BEACON_PERSISTENT_SCHEDULES_PERMANENT_COUNTDOWN;
schedule->ps.ps[0].sais[0].stpf = false;
diff --git a/cesar/bsu/test/utest/src/schedules.c b/cesar/bsu/test/utest/src/schedules.c
index a18ceb6527..61953497a0 100644
--- a/cesar/bsu/test/utest/src/schedules.c
+++ b/cesar/bsu/test/utest/src/schedules.c
@@ -260,7 +260,7 @@ test_case_ca_schedules_intellon (test_t test)
bsu_beacon_process (t.bsu, pbbeacon, &brx);
/* Schedules which should be present. */
test_fail_unless (t.bsu->sta_avln->bs.schedules.ps.nb == 1);
- test_fail_unless (t.bsu->sta_avln->bs.schedules.ps.ps[0].pscd == 7);
+ test_fail_unless (t.bsu->sta_avln->bs.schedules.ps.ps[0].pscd == 0);
test_fail_unless (t.bsu->sta_avln->bs.schedules.ps.ps[0].cscd == 7);
test_fail_unless (
t.bsu->sta_avln->bs.schedules.ps.ps[0].sais[0].glid ==